mitteLib
Loading...
Searching...
No Matches
log.hpp File Reference
#include <chrono>
#include <cstdio>
Include dependency graph for log.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  mlab
 

Macros

#define MLAB_LOG_COLOR_E   "\033[0;31m"
 
#define MLAB_LOG_COLOR_W   "\033[0;33m"
 
#define MLAB_LOG_COLOR_I   "\033[0;32m"
 
#define MLAB_LOG_COLOR_D
 
#define MLAB_LOG_COLOR_V
 
#define MLAB_LOG_RESET_COLOR   "\033[0m"
 
#define MLAB_LOG_FORMAT(letter, format)
 
#define LOG_LOCAL_LEVEL   mlab::log_level::info
 
#define LOG_LEVEL(level, tag, format, letter, ...)
 
#define LOGE(tag, format, ...)
 
#define LOGW(tag, format, ...)
 
#define LOGI(tag, format, ...)
 
#define LOGD(tag, format, ...)
 
#define LOGV(tag, format, ...)
 

Enumerations

enum struct  mlab::log_level : int {
  mlab::none , mlab::error , mlab::warn , mlab::info ,
  mlab::debug , mlab::verbose
}
 

Functions

std::uint32_t mlab::log_timestamp ()
 

Macro Definition Documentation

◆ LOG_LEVEL

#define LOG_LEVEL ( level,
tag,
format,
letter,
... )
Value:
do { \
if (static_cast<int>(LOG_LOCAL_LEVEL) >= static_cast<int>(level)) \
std::printf((MLAB_LOG_FORMAT(letter, format)), ::mlab::log_timestamp(), tag, ##__VA_ARGS__); \
} while (false)
#define LOG_LOCAL_LEVEL
Definition log.hpp:45
#define MLAB_LOG_FORMAT(letter, format)
Definition log.hpp:42
std::uint32_t log_timestamp()
Definition log.cpp:11

◆ LOG_LOCAL_LEVEL

#define LOG_LOCAL_LEVEL   mlab::log_level::info

◆ LOGD

#define LOGD ( tag,
format,
... )
Value:
LOG_LEVEL(mlab::log_level::debug, tag, format, D, ##__VA_ARGS__)
#define LOG_LEVEL(level, tag, format, letter,...)
Definition log.hpp:49

◆ LOGE

#define LOGE ( tag,
format,
... )
Value:
LOG_LEVEL(mlab::log_level::error, tag, format, E, ##__VA_ARGS__)

◆ LOGI

#define LOGI ( tag,
format,
... )
Value:
LOG_LEVEL(mlab::log_level::info, tag, format, I, ##__VA_ARGS__)

◆ LOGV

#define LOGV ( tag,
format,
... )
Value:
LOG_LEVEL(mlab::log_level::verbose, tag, format, V, ##__VA_ARGS__)

◆ LOGW

#define LOGW ( tag,
format,
... )
Value:
LOG_LEVEL(mlab::log_level::warn, tag, format, W, ##__VA_ARGS__)

◆ MLAB_LOG_COLOR_D

#define MLAB_LOG_COLOR_D

◆ MLAB_LOG_COLOR_E

#define MLAB_LOG_COLOR_E   "\033[0;31m"

◆ MLAB_LOG_COLOR_I

#define MLAB_LOG_COLOR_I   "\033[0;32m"

◆ MLAB_LOG_COLOR_V

#define MLAB_LOG_COLOR_V

◆ MLAB_LOG_COLOR_W

#define MLAB_LOG_COLOR_W   "\033[0;33m"

◆ MLAB_LOG_FORMAT

#define MLAB_LOG_FORMAT ( letter,
format )
Value:
MLAB_LOG_COLOR_##letter #letter " (%u) %s: " format MLAB_LOG_RESET_COLOR "\n"
#define MLAB_LOG_RESET_COLOR
Definition log.hpp:41

◆ MLAB_LOG_RESET_COLOR

#define MLAB_LOG_RESET_COLOR   "\033[0m"