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

Make new Logger properly work on worker test units

上级 6bf1dcdd
......@@ -57,10 +57,10 @@
'conditions':
[
[ 'target_arch == "ia32"', {
'xcode_settings': { 'ARCHS': ['i386'] }
'xcode_settings': { 'ARCHS': [ 'i386' ] }
}],
['target_arch == "x64"', {
'xcode_settings': { 'ARCHS': ['x86_64'] }
[ 'target_arch == "x64"', {
'xcode_settings': { 'ARCHS': [ 'x86_64' ] }
}],
[ 'OS in "linux freebsd openbsd solaris"', {
'target_conditions':
......
......@@ -12,7 +12,6 @@
* verbose information, including current file and line.
*
* MS_TRACE()
* MS_TRACE_STD()
*
* Logs the current method/function if the current source file defines the
* MS_LOG_TRACE macro.
......@@ -41,7 +40,6 @@
* MS_DEBUG_DEV("Room closed [roomId:%" PRIu32 "]", roomId);
*
* MS_ERROR(...)
* MS_ERROR_STD(...)
*
* Logs an error. Must just be used for internal errors that should not
* happen.
......@@ -134,6 +132,17 @@ public:
} \
while (0)
#define MS_DEBUG_TAG_STD(tag, desc, ...) \
do \
{ \
if (LogLevel::LOG_DEBUG == Settings::configuration.logLevel && (_MS_TAG_ENABLED(tag) || _MS_LOG_DEV_ENABLED)) \
{ \
std::fprintf(stdout, _MS_LOG_STR_DESC desc _MS_LOG_SEPARATOR_CHAR_STD, _MS_LOG_ARG, ##__VA_ARGS__); \
std::fflush(stdout); \
} \
} \
while (0)
#define MS_WARN_TAG(tag, desc, ...) \
do \
{ \
......@@ -145,6 +154,17 @@ public:
} \
while (0)
#define MS_WARN_TAG_STD(tag, desc, ...) \
do \
{ \
if (LogLevel::LOG_WARN <= Settings::configuration.logLevel && (_MS_TAG_ENABLED(tag) || _MS_LOG_DEV_ENABLED)) \
{ \
std::fprintf(stderr, _MS_LOG_STR_DESC desc _MS_LOG_SEPARATOR_CHAR_STD, _MS_LOG_ARG, ##__VA_ARGS__); \
std::fflush(stderr); \
} \
} \
while (0)
#define MS_DEBUG_2TAGS(tag1, tag2, desc, ...) \
do \
{ \
......@@ -156,6 +176,17 @@ public:
} \
while (0)
#define MS_DEBUG_2TAGS_STD(tag, desc, ...) \
do \
{ \
if (LogLevel::LOG_DEBUG == Settings::configuration.logLevel && (_MS_TAG_ENABLED_2(tag1, tag2) || _MS_LOG_DEV_ENABLED)) \
{ \
std::fprintf(stdout, _MS_LOG_STR_DESC desc _MS_LOG_SEPARATOR_CHAR_STD, _MS_LOG_ARG, ##__VA_ARGS__); \
std::fflush(stdout); \
} \
} \
while (0)
#define MS_WARN_2TAGS(tag1, tag2, desc, ...) \
do \
{ \
......@@ -167,6 +198,17 @@ public:
} \
while (0)
#define MS_WARN_2TAGS_STD(tag1, tag2, desc, ...) \
do \
{ \
if (LogLevel::LOG_WARN <= Settings::configuration.logLevel && (_MS_TAG_ENABLED_2(tag1, tag2) || _MS_LOG_DEV_ENABLED)) \
{ \
std::fprintf(stderr, _MS_LOG_STR_DESC desc _MS_LOG_SEPARATOR_CHAR_STD, _MS_LOG_ARG, ##__VA_ARGS__); \
std::fflush(stderr); \
} \
} \
while (0)
#ifdef MS_LOG_DEV
#define MS_DEBUG_DEV(desc, ...) \
do \
......@@ -179,6 +221,17 @@ public:
} \
while (0)
#define MS_DEBUG_DEV_STD(desc, ...) \
do \
{ \
if (LogLevel::LOG_DEBUG == Settings::configuration.logLevel) \
{ \
std::fprintf(stdout, _MS_LOG_STR_DESC desc _MS_LOG_SEPARATOR_CHAR_STD, _MS_LOG_ARG, ##__VA_ARGS__); \
std::fflush(stdout); \
} \
} \
while (0)
#define MS_WARN_DEV(desc, ...) \
do \
{ \
......@@ -189,9 +242,22 @@ public:
} \
} \
while (0)
#define MS_WARN_DEV_STD(desc, ...) \
do \
{ \
if (LogLevel::LOG_WARN <= Settings::configuration.logLevel) \
{ \
std::fprintf(stderr, _MS_LOG_STR_DESC desc _MS_LOG_SEPARATOR_CHAR_STD, _MS_LOG_ARG, ##__VA_ARGS__); \
std::fflush(stderr); \
} \
} \
while (0)
#else
#define MS_DEBUG_DEV(desc, ...)
#define MS_DEBUG_DEV_STD(desc, ...)
#define MS_WARN_DEV(desc, ...)
#define MS_WARN_DEV_STD(desc, ...)
#endif
#define MS_ERROR(desc, ...) \
......@@ -228,10 +294,18 @@ public:
#ifdef MS_LOG_STD
#undef MS_TRACE
#define MS_TRACE MS_TRACE_STD
#undef MS_DEBUG
#define MS_DEBUG MS_DEBUG_STD
#undef MS_WARN
#define MS_WARN MS_DEBUG_STD
#undef MS_DEBUG_TAG
#define MS_DEBUG_TAG MS_DEBUG_TAG_STD
#undef MS_WARN_TAG
#define MS_WARN_TAG MS_WARN_TAG_STD
#undef MS_DEBUG_2TAGS
#define MS_DEBUG_2TAGS MS_DEBUG_2TAGS_STD
#undef MS_WARN_2TAGS
#define MS_WARN_2TAGS MS_WARN_2TAGS_STD
#undef MS_DEBUG_DEV
#define MS_DEBUG_DEV MS_DEBUG_DEV_STD
#undef MS_WARN_DEV
#define MS_WARN_DEV MS_WARN_DEV_STD
#undef MS_ERROR
#define MS_ERROR MS_ERROR_STD
#endif
......
......@@ -161,10 +161,10 @@
# Endianness
[ 'node_byteorder=="big"', {
# Define Big Endian
'defines': ['MS_BIG_ENDIAN']
'defines': [ 'MS_BIG_ENDIAN' ]
}, {
# Define Little Endian
'defines': ['MS_LITTLE_ENDIAN']
'defines': [ 'MS_LITTLE_ENDIAN' ]
}],
# Platform-specifics
......@@ -226,7 +226,7 @@
},
{
'target_name': 'mediasoup-worker-test',
'defines': ['MS_LOG_STD'],
'defines': [ 'MS_LOG_STD' ],
'sources':
[
# C++ source files
......
......@@ -5,7 +5,7 @@
/* Class variables. */
std::string Logger::id = "undefined";
std::string Logger::id = "unset";
Channel::UnixStreamSocket* Logger::channel = nullptr;
char Logger::buffer[MS_LOGGER_BUFFER_SIZE];
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论