|
@@ -1,20 +1,20 @@
|
|
|
// // ******************************************************************
|
|
|
-// // /\ /| @File Logger.cpp
|
|
|
+// // /\ /| @File loger.cc
|
|
|
// // \ V/ @Brief
|
|
|
// // | "") @Author lijinwen, ghz005@uni-trend.com.cn
|
|
|
// // / | @Creation 2024-05-16
|
|
|
-// // / \\ @Modified 2024-06-05
|
|
|
+// // / \\ @Modified 2024-06-24
|
|
|
// // *(__\_\
|
|
|
// // ******************************************************************
|
|
|
|
|
|
-#include "Logger.h"
|
|
|
+#include "Loger.h"
|
|
|
|
|
|
namespace Protocol
|
|
|
{
|
|
|
- std::mutex Logger::InstanceMutex_ = std::mutex();
|
|
|
- Logger Logger::Instance_ = Logger();
|
|
|
+ std::mutex Loger::InstanceMutex_ = std::mutex();
|
|
|
+ Loger Loger::Instance_ = Loger();
|
|
|
|
|
|
- Logger::Logger()
|
|
|
+ Loger::Loger()
|
|
|
{
|
|
|
LogPath_ = "./DecoderLogs/";
|
|
|
if (!Fs::exists(LogPath_))
|
|
@@ -32,7 +32,7 @@ namespace Protocol
|
|
|
LogFile_.open(LogFileName_, std::ios::out | std::ios::app);
|
|
|
}
|
|
|
|
|
|
- void Logger::Log(const std::string& message)
|
|
|
+ void Loger::Log(const std::string& message)
|
|
|
{
|
|
|
std::lock_guard<std::mutex> lock(InstanceMutex_); // 锁定以保证线程安全
|
|
|
time_t now = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
|
|
@@ -50,7 +50,7 @@ namespace Protocol
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- Logger::~Logger()
|
|
|
+ Loger::~Loger()
|
|
|
{
|
|
|
if (LogFile_.is_open())
|
|
|
{
|
|
@@ -60,8 +60,8 @@ namespace Protocol
|
|
|
|
|
|
void WriteLog(LogLevel level, const char* format, ...)
|
|
|
{
|
|
|
- if (Logger::LogLevel != LogLevel::All
|
|
|
- && (Logger::LogLevel == LogLevel::Close || level > Logger::LogLevel))
|
|
|
+ if (Loger::LogLevel != LogLevel::All
|
|
|
+ && (Loger::LogLevel == LogLevel::Close || level > Loger::LogLevel))
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
@@ -73,6 +73,6 @@ namespace Protocol
|
|
|
vsnprintf(buffer, sizeof(buffer), format, args);
|
|
|
va_end(args);
|
|
|
|
|
|
- Logger::Log(buffer);
|
|
|
+ Loger::Log(buffer);
|
|
|
}
|
|
|
}
|