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

Make new Logger properly work on worker test units

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