36#define MLAB_LOG_COLOR_E "\033[0;31m"
37#define MLAB_LOG_COLOR_W "\033[0;33m"
38#define MLAB_LOG_COLOR_I "\033[0;32m"
39#define MLAB_LOG_COLOR_D
40#define MLAB_LOG_COLOR_V
41#define MLAB_LOG_RESET_COLOR "\033[0m"
42#define MLAB_LOG_FORMAT(letter, format) MLAB_LOG_COLOR_##letter #letter " (%u) %s: " format MLAB_LOG_RESET_COLOR "\n"
44#ifndef LOG_LOCAL_LEVEL
45#define LOG_LOCAL_LEVEL mlab::log_level::info
49#define LOG_LEVEL(level, tag, format, letter, ...) \
51 if (static_cast<int>(LOG_LOCAL_LEVEL) >= static_cast<int>(level)) \
52 std::printf((MLAB_LOG_FORMAT(letter, format)), ::mlab::log_timestamp(), tag, ##__VA_ARGS__); \
55#define LOGE(tag, format, ...) LOG_LEVEL(mlab::log_level::error, tag, format, E, ##__VA_ARGS__)
56#define LOGW(tag, format, ...) LOG_LEVEL(mlab::log_level::warn, tag, format, W, ##__VA_ARGS__)
57#define LOGI(tag, format, ...) LOG_LEVEL(mlab::log_level::info, tag, format, I, ##__VA_ARGS__)
58#define LOGD(tag, format, ...) LOG_LEVEL(mlab::log_level::debug, tag, format, D, ##__VA_ARGS__)
59#define LOGV(tag, format, ...) LOG_LEVEL(mlab::log_level::verbose, tag, format, V, ##__VA_ARGS__)
std::uint32_t log_timestamp()
Definition log.cpp:11
log_level
Definition log.hpp:26