29#ifndef SBL_LOG_MACROS_HPP_
30#define SBL_LOG_MACROS_HPP_
37 #define SBL_LOG_LEVEL 3
41#define SBL_LOG_LEVEL_OFF 0
42#define SBL_LOG_LEVEL_ERROR 1
43#define SBL_LOG_LEVEL_WARN 2
44#define SBL_LOG_LEVEL_INFO 3
45#define SBL_LOG_LEVEL_DEBUG 4
46#define SBL_LOG_LEVEL_TRACE 5
50 #define SBL_LOG_OUTPUT sbl::log::NullOutput
54#ifndef SBL_LOG_TIMESTAMP
55 #define SBL_LOG_TIMESTAMP sbl::log::NullTimestamp
61 return static_cast<Level>(lvl);
78#if SBL_LOG_LEVEL >= SBL_LOG_LEVEL_ERROR
79 #define SBL_LOG_ERROR(...) \
80 SblLogger_::log(sbl::log::Level::Error, __FILE__, __LINE__, __VA_ARGS__)
82 #define SBL_LOG_ERROR(...) ((void)0)
85#if SBL_LOG_LEVEL >= SBL_LOG_LEVEL_WARN
86 #define SBL_LOG_WARN(...) \
87 SblLogger_::log(sbl::log::Level::Warn, __FILE__, __LINE__, __VA_ARGS__)
89 #define SBL_LOG_WARN(...) ((void)0)
92#if SBL_LOG_LEVEL >= SBL_LOG_LEVEL_INFO
93 #define SBL_LOG_INFO(...) \
94 SblLogger_::log(sbl::log::Level::Info, __FILE__, __LINE__, __VA_ARGS__)
96 #define SBL_LOG_INFO(...) ((void)0)
99#if SBL_LOG_LEVEL >= SBL_LOG_LEVEL_DEBUG
100 #define SBL_LOG_DEBUG(...) \
101 SblLogger_::log(sbl::log::Level::Debug, __FILE__, __LINE__, __VA_ARGS__)
103 #define SBL_LOG_DEBUG(...) ((void)0)
106#if SBL_LOG_LEVEL >= SBL_LOG_LEVEL_TRACE
107 #define SBL_LOG_TRACE(...) \
108 SblLogger_::log(sbl::log::Level::Trace, __FILE__, __LINE__, __VA_ARGS__)
110 #define SBL_LOG_TRACE(...) ((void)0)
116#define SBL_LOG_ERROR_IF(cond, ...) \
117 do { if (cond) { SBL_LOG_ERROR(__VA_ARGS__); } } while(0)
119#define SBL_LOG_WARN_IF(cond, ...) \
120 do { if (cond) { SBL_LOG_WARN(__VA_ARGS__); } } while(0)
122#define SBL_LOG_INFO_IF(cond, ...) \
123 do { if (cond) { SBL_LOG_INFO(__VA_ARGS__); } } while(0)
128#if SBL_LOG_LEVEL > SBL_LOG_LEVEL_OFF
129 #define SBL_LOG_SIMPLE(lvl, ...) \
130 SblLogger_::log_simple(lvl, __VA_ARGS__)
132 #define SBL_LOG_SIMPLE(lvl, ...) ((void)0)
Logger class with compile-time level filtering.
Logger class with timestamp provider and output sink.
#define SBL_LOG_TIMESTAMP
constexpr Level level_from_int(int lvl)
Level
Log severity levels.