Logging for libraries.
More...
#include <cstdint>
#include <chrono>
Go to the source code of this file.
|
namespace | m5 |
| Top level namespace of M5.
|
|
|
#define | M5_LIB_LOGE(format, ...) |
| Output log (level ERROR)
|
|
#define | M5_LIB_LOGW(format, ...) |
| Output log (level WARN)
|
|
#define | M5_LIB_LOGI(format, ...) |
| Output log (level INFO)
|
|
#define | M5_LIB_LOGD(format, ...) |
| Output log (level DEBUG)
|
|
#define | M5_LIB_LOGV(format, ...) |
| Output log (level VERBOSE)
|
|
#define | M5_DUMPE(addr, len) |
| Output log (level ERROR)
|
|
#define | M5_DUMPW(addr, len) |
| Output log (level WARN)
|
|
#define | M5_DUMPI(addr, len) |
| Output log (level INFO)
|
|
#define | M5_DUMPD(addr, len) |
| Output log (level DEBUG)
|
|
#define | M5_DUMPV(addr, len) |
| Output log (level VERBOSE)
|
|
|
using | m5::utility::log::log_level_t = LogLevel |
|
using | m5::utility::log::elapsed_time_t = std::chrono::milliseconds |
|
|
constexpr const char * | m5::utility::log::pathToFilename (const char *path) |
| Gets the filename from full pathname.
|
|
void | m5::utility::log::logPrintf (const char *format,...) |
| Output formatted strings.
|
|
void | m5::utility::log::dump (const void *addr, const size_t len, const bool align=true) |
| Output dump.
|
|
elapsed_time_t | m5::utility::log::elapsedTime () |
| Gets the elapsed time for log.
|
|
◆ M5_DUMPD
#define M5_DUMPD |
( |
| addr, |
|
|
| len ) |
Value: do { \
if (m5::utility::log::logOutputLevel >= m5::utility::log::log_level_t::Debug) { \
m5::utility::log::dump((addr), (len)); \
} \
} while (0)
Output log (level DEBUG)
◆ M5_DUMPE
#define M5_DUMPE |
( |
| addr, |
|
|
| len ) |
Value: do { \
if (m5::utility::log::logOutputLevel >= m5::utility::log::log_level_t::Error) { \
m5::utility::log::dump((addr), (len)); \
} \
} while (0)
Output log (level ERROR)
◆ M5_DUMPI
#define M5_DUMPI |
( |
| addr, |
|
|
| len ) |
Value: do { \
if (m5::utility::log::logOutputLevel >= m5::utility::log::log_level_t::Info) { \
m5::utility::log::dump((addr), (len)); \
} \
} while (0)
Output log (level INFO)
◆ M5_DUMPV
#define M5_DUMPV |
( |
| addr, |
|
|
| len ) |
Value: do { \
if (m5::utility::log::logOutputLevel >= m5::utility::log::log_level_t::Verbose) { \
m5::utility::log::dump((addr), (len)); \
} \
} while (0)
Output log (level VERBOSE)
◆ M5_DUMPW
#define M5_DUMPW |
( |
| addr, |
|
|
| len ) |
Value: do { \
if (m5::utility::log::logOutputLevel >= m5::utility::log::log_level_t::Warn) { \
m5::utility::log::dump((addr), (len)); \
} \
} while (0)
Output log (level WARN)
◆ M5_LIB_LOGD
#define M5_LIB_LOGD |
( |
| format, |
|
|
| ... ) |
Value: do { \
if (m5::utility::log::logOutputLevel >= m5::utility::log::log_level_t::Debug) { \
m5::utility::log::logPrintf(M5_UTILITY_LOG_FORMAT(D, format), ##__VA_ARGS__); \
} \
} while (0)
Output log (level DEBUG)
◆ M5_LIB_LOGE
#define M5_LIB_LOGE |
( |
| format, |
|
|
| ... ) |
Value: do { \
if (m5::utility::log::logOutputLevel >= m5::utility::log::log_level_t::Error) { \
m5::utility::log::logPrintf(M5_UTILITY_LOG_FORMAT(E, format), ##__VA_ARGS__); \
} \
} while (0)
Output log (level ERROR)
◆ M5_LIB_LOGI
#define M5_LIB_LOGI |
( |
| format, |
|
|
| ... ) |
Value: do { \
if (m5::utility::log::logOutputLevel >= m5::utility::log::log_level_t::Info) { \
m5::utility::log::logPrintf(M5_UTILITY_LOG_FORMAT(I, format), ##__VA_ARGS__); \
} \
} while (0)
Output log (level INFO)
◆ M5_LIB_LOGV
#define M5_LIB_LOGV |
( |
| format, |
|
|
| ... ) |
Value: do { \
if (m5::utility::log::logOutputLevel >= m5::utility::log::log_level_t::Verbose) { \
m5::utility::log::logPrintf(M5_UTILITY_LOG_FORMAT(V, format), ##__VA_ARGS__); \
} \
} while (0)
Output log (level VERBOSE)
◆ M5_LIB_LOGW
#define M5_LIB_LOGW |
( |
| format, |
|
|
| ... ) |
Value: do { \
if (m5::utility::log::logOutputLevel >= m5::utility::log::log_level_t::Warn) { \
m5::utility::log::logPrintf(M5_UTILITY_LOG_FORMAT(W, format), ##__VA_ARGS__); \
} \
} while (0)
Output log (level WARN)
◆ LogLevel
Enumerator |
---|
None | No output.
|
Error | Error.
|
Warn | Warning.
|
Info | Information.
|
Debug | Debug.
|
Verbose | Verbose.
|
◆ pathToFilename()
const char * m5::utility::log::pathToFilename |
( |
const char * | path | ) |
|
|
constexpr |
Gets the filename from full pathname.
- Warning
- If the string is too long, the recursion depth may be too deep to fail. (If compile time calculation)
◆ logOutputLevel
log_level_t m5::utility::log::logOutputLevel = log_level_t::None |
|
constexpr |
Base value of log level to be output.
The value can be specified in the compile options. -DM5_LOG_LEVEL=[0..5] or -DCORE_LOG_LEVEL=[0...5] default as NONE
- Warning
- No output if NDEBUG defined