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

worker: Remove ugly properties.

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