diff options
Diffstat (limited to 'src/common/logging/log.h')
| -rw-r--r-- | src/common/logging/log.h | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/src/common/logging/log.h b/src/common/logging/log.h index bda3d633a..3d94bf0d9 100644 --- a/src/common/logging/log.h +++ b/src/common/logging/log.h | |||
| @@ -74,17 +74,6 @@ enum class Class : ClassType { | |||
| 74 | }; | 74 | }; |
| 75 | 75 | ||
| 76 | /** | 76 | /** |
| 77 | * Level below which messages are simply discarded without buffering regardless of the display | ||
| 78 | * settings. | ||
| 79 | */ | ||
| 80 | const Level MINIMUM_LEVEL = | ||
| 81 | #ifdef _DEBUG | ||
| 82 | Level::Trace; | ||
| 83 | #else | ||
| 84 | Level::Debug; | ||
| 85 | #endif | ||
| 86 | |||
| 87 | /** | ||
| 88 | * Logs a message to the global logger. This proxy exists to avoid exposing the details of the | 77 | * Logs a message to the global logger. This proxy exists to avoid exposing the details of the |
| 89 | * Logger class, including the ConcurrentRingBuffer template, to all files that desire to log | 78 | * Logger class, including the ConcurrentRingBuffer template, to all files that desire to log |
| 90 | * messages, reducing unecessary recompilations. | 79 | * messages, reducing unecessary recompilations. |
| @@ -103,13 +92,15 @@ void LogMessage(Class log_class, Level log_level, | |||
| 103 | } // namespace Log | 92 | } // namespace Log |
| 104 | 93 | ||
| 105 | #define LOG_GENERIC(log_class, log_level, ...) \ | 94 | #define LOG_GENERIC(log_class, log_level, ...) \ |
| 106 | do { \ | 95 | ::Log::LogMessage(::Log::Class::log_class, ::Log::Level::log_level, \ |
| 107 | if (::Log::Level::log_level >= ::Log::MINIMUM_LEVEL) \ | 96 | __FILE__, __LINE__, __func__, __VA_ARGS__) |
| 108 | ::Log::LogMessage(::Log::Class::log_class, ::Log::Level::log_level, \ | ||
| 109 | __FILE__, __LINE__, __func__, __VA_ARGS__); \ | ||
| 110 | } while (0) | ||
| 111 | 97 | ||
| 98 | #ifdef _DEBUG | ||
| 112 | #define LOG_TRACE( log_class, ...) LOG_GENERIC(log_class, Trace, __VA_ARGS__) | 99 | #define LOG_TRACE( log_class, ...) LOG_GENERIC(log_class, Trace, __VA_ARGS__) |
| 100 | #else | ||
| 101 | #define LOG_TRACE( log_class, ...) (void(0)) | ||
| 102 | #endif | ||
| 103 | |||
| 113 | #define LOG_DEBUG( log_class, ...) LOG_GENERIC(log_class, Debug, __VA_ARGS__) | 104 | #define LOG_DEBUG( log_class, ...) LOG_GENERIC(log_class, Debug, __VA_ARGS__) |
| 114 | #define LOG_INFO( log_class, ...) LOG_GENERIC(log_class, Info, __VA_ARGS__) | 105 | #define LOG_INFO( log_class, ...) LOG_GENERIC(log_class, Info, __VA_ARGS__) |
| 115 | #define LOG_WARNING( log_class, ...) LOG_GENERIC(log_class, Warning, __VA_ARGS__) | 106 | #define LOG_WARNING( log_class, ...) LOG_GENERIC(log_class, Warning, __VA_ARGS__) |