提交 a457176a authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo

worker: Remove ugly properties.

上级 aa587a71
...@@ -47,29 +47,14 @@ class Logger ...@@ -47,29 +47,14 @@ class Logger
{ {
public: public:
static void Init(const std::string id); static void Init(const std::string id);
static const char* GetProcessName();
static const char* GetProcessMinName();
static bool HasDebugLevel(); static bool HasDebugLevel();
private: public:
static std::string processName; static std::string id;
static std::string processMinName;
}; };
/* Inline static methods. */ /* Inline static methods. */
inline
const char* Logger::GetProcessName()
{
return Logger::processName.c_str();
}
inline
const char* Logger::GetProcessMinName()
{
return Logger::processMinName.c_str();
}
inline inline
bool Logger::HasDebugLevel() bool Logger::HasDebugLevel()
{ {
...@@ -82,11 +67,11 @@ bool Logger::HasDebugLevel() ...@@ -82,11 +67,11 @@ bool Logger::HasDebugLevel()
#define _MS_LOG_STR "[%s] %s:%d | %s::%s()" #define _MS_LOG_STR "[%s] %s:%d | %s::%s()"
#define _MS_LOG_STR_DESC _MS_LOG_STR " | " #define _MS_LOG_STR_DESC _MS_LOG_STR " | "
#define _MS_FILE (std::strchr(__FILE__, '/') ? std::strchr(__FILE__, '/') + 1 : __FILE__) #define _MS_FILE (std::strchr(__FILE__, '/') ? std::strchr(__FILE__, '/') + 1 : __FILE__)
#define _MS_LOG_ARG Logger::GetProcessName(), _MS_FILE, __LINE__, MS_CLASS, __FUNCTION__ #define _MS_LOG_ARG ("id:" + Logger::id).c_str(), _MS_FILE, __LINE__, MS_CLASS, __FUNCTION__
#else #else
#define _MS_LOG_STR "[%s] %s::%s()" #define _MS_LOG_STR "[%s] %s::%s()"
#define _MS_LOG_STR_DESC _MS_LOG_STR " | " #define _MS_LOG_STR_DESC _MS_LOG_STR " | "
#define _MS_LOG_ARG Logger::GetProcessMinName(), MS_CLASS, __FUNCTION__ #define _MS_LOG_ARG ("id:" + Logger::id).c_str(), MS_CLASS, __FUNCTION__
#endif #endif
#define _MS_TO_STDOUT() \ #define _MS_TO_STDOUT() \
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#define MS_APP_NAME "mediasoup" #define MS_APP_NAME "mediasoup"
#define MS_PROCESS_NAME "mediasoup-worker" #define MS_PROCESS_NAME "mediasoup-worker"
#define MS_PROCESS_MIN_NAME "worker"
#define MS_LOG_LEVEL_DEBUG 3 #define MS_LOG_LEVEL_DEBUG 3
#define MS_LOG_LEVEL_INFO 2 #define MS_LOG_LEVEL_INFO 2
......
...@@ -4,15 +4,13 @@ ...@@ -4,15 +4,13 @@
/* Static variables. */ /* Static variables. */
std::string Logger::processName; std::string Logger::id;
std::string Logger::processMinName;
/* Static methods. */ /* Static methods. */
void Logger::Init(const std::string id) void Logger::Init(const std::string id)
{ {
Logger::processName = MS_PROCESS_NAME ":" + id; Logger::id = id;
Logger::processMinName = MS_PROCESS_MIN_NAME ":" + id;
MS_TRACE(); MS_TRACE();
} }
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论