|
Sound Byte Libs 0.5.1-340-gab5b79a
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
|
Zero-overhead logging macros with file/line capture. More...
Zero-overhead logging macros with file/line capture.
This header names no device. Without SBL_LOG_OUTPUT and SBL_LOG_TIMESTAMP the logger writes nothing and stamps 0. Firmware includes <sbl/log.hpp>, which picks the build's sink and timestamp and then includes this.
Usage:
SBL_LOG_LEVEL is an integer, so the preprocessor can filter on it:
Definition in file macros.hpp.
#include <sbl/common/log/logger.hpp>Go to the source code of this file.
Namespaces | |
| namespace | sbl |
| Root namespace for all Sound Byte Libs code. | |
| namespace | sbl::log |
| Logging. | |
Macros | |
| #define | SBL_LOG_LEVEL 3 |
| #define | SBL_LOG_LEVEL_OFF 0 |
| #define | SBL_LOG_LEVEL_ERROR 1 |
| #define | SBL_LOG_LEVEL_WARN 2 |
| #define | SBL_LOG_LEVEL_INFO 3 |
| #define | SBL_LOG_LEVEL_DEBUG 4 |
| #define | SBL_LOG_LEVEL_TRACE 5 |
| #define | SBL_LOG_OUTPUT sbl::log::NullOutput |
| #define | SBL_LOG_TIMESTAMP sbl::log::NullTimestamp |
| #define | SBL_LOG_ERROR(...) SblLogger_::log(sbl::log::Level::Error, __FILE__, __LINE__, __VA_ARGS__) |
| Main logging macros with compile-time level filtering. | |
| #define | SBL_LOG_WARN(...) SblLogger_::log(sbl::log::Level::Warn, __FILE__, __LINE__, __VA_ARGS__) |
| #define | SBL_LOG_INFO(...) SblLogger_::log(sbl::log::Level::Info, __FILE__, __LINE__, __VA_ARGS__) |
| #define | SBL_LOG_DEBUG(...) SblLogger_::log(sbl::log::Level::Debug, __FILE__, __LINE__, __VA_ARGS__) |
| #define | SBL_LOG_TRACE(...) SblLogger_::log(sbl::log::Level::Trace, __FILE__, __LINE__, __VA_ARGS__) |
| #define | SBL_LOG_ERROR_IF(cond, ...) |
| Conditional logging (runtime condition, compile-time level check) | |
| #define | SBL_LOG_WARN_IF(cond, ...) |
| #define | SBL_LOG_INFO_IF(cond, ...) |
| #define | SBL_LOG_SIMPLE(lvl, ...) ((void)0) |
| Log without file/line (smaller output) | |
Typedefs | |
| using | SblLogger_ = sbl::log::Logger< SBL_LOG_OUTPUT, SBL_LOG_TIMESTAMP, sbl::log::detail::level_from_int(SBL_LOG_LEVEL)> |
| #define SBL_LOG_LEVEL 3 |
Definition at line 42 of file macros.hpp.
| #define SBL_LOG_LEVEL_OFF 0 |
Definition at line 46 of file macros.hpp.
| #define SBL_LOG_LEVEL_ERROR 1 |
Definition at line 47 of file macros.hpp.
| #define SBL_LOG_LEVEL_WARN 2 |
Definition at line 48 of file macros.hpp.
| #define SBL_LOG_LEVEL_INFO 3 |
Definition at line 49 of file macros.hpp.
| #define SBL_LOG_LEVEL_DEBUG 4 |
Definition at line 50 of file macros.hpp.
| #define SBL_LOG_LEVEL_TRACE 5 |
Definition at line 51 of file macros.hpp.
| #define SBL_LOG_OUTPUT sbl::log::NullOutput |
Definition at line 55 of file macros.hpp.
| #define SBL_LOG_TIMESTAMP sbl::log::NullTimestamp |
Definition at line 59 of file macros.hpp.
| #define SBL_LOG_ERROR | ( | ... | ) | SblLogger_::log(sbl::log::Level::Error, __FILE__, __LINE__, __VA_ARGS__) |
Main logging macros with compile-time level filtering.
These expand to nothing when the level is disabled, achieving zero overhead for disabled log levels.
Definition at line 77 of file macros.hpp.
| #define SBL_LOG_WARN | ( | ... | ) | SblLogger_::log(sbl::log::Level::Warn, __FILE__, __LINE__, __VA_ARGS__) |
Definition at line 83 of file macros.hpp.
| #define SBL_LOG_INFO | ( | ... | ) | SblLogger_::log(sbl::log::Level::Info, __FILE__, __LINE__, __VA_ARGS__) |
Definition at line 89 of file macros.hpp.
| #define SBL_LOG_DEBUG | ( | ... | ) | SblLogger_::log(sbl::log::Level::Debug, __FILE__, __LINE__, __VA_ARGS__) |
Definition at line 95 of file macros.hpp.
| #define SBL_LOG_TRACE | ( | ... | ) | SblLogger_::log(sbl::log::Level::Trace, __FILE__, __LINE__, __VA_ARGS__) |
Definition at line 101 of file macros.hpp.
| #define SBL_LOG_ERROR_IF | ( | cond, | |
| ... | |||
| ) |
Conditional logging (runtime condition, compile-time level check)
Definition at line 109 of file macros.hpp.
| #define SBL_LOG_WARN_IF | ( | cond, | |
| ... | |||
| ) |
Definition at line 116 of file macros.hpp.
| #define SBL_LOG_INFO_IF | ( | cond, | |
| ... | |||
| ) |
Definition at line 123 of file macros.hpp.
| #define SBL_LOG_SIMPLE | ( | lvl, | |
| ... | |||
| ) | ((void)0) |
Log without file/line (smaller output)
Definition at line 136 of file macros.hpp.
| using SblLogger_ = sbl::log::Logger<SBL_LOG_OUTPUT, SBL_LOG_TIMESTAMP, sbl::log::detail::level_from_int(SBL_LOG_LEVEL)> |
Definition at line 68 of file macros.hpp.