- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
#if !defined LOG_PRINT_FNAME && !defined LOG_PRINT_LVL && \
!defined LOG_PRINT_DATE && !defined LOG_PRINT_TIME && \
!defined LOG_TIME_FMT && !defined LOG_DATETIME_SEP && \
!defined LOG_PRINT_TIMER && !defined LOG_VERB
#warning No logging options specified, default config will be used
#endif
// Initialize unitialized values
#ifndef LOG_PRINT_FNAME
#define LOG_PRINT_FNAME true
#endif
#ifndef LOG_PRINT_LVL
#define LOG_PRINT_LVL false
#endif
#ifndef LOG_PRINT_DATE
#define LOG_PRINT_DATE false
#endif
#ifndef LOG_PRINT_TIME
#define LOG_PRINT_TIME false
#endif
#ifndef LOG_DATE_FMT
#define LOG_DATE_FMT "%D"
#endif
#ifndef LOG_TIME_FMT
#define LOG_TIME_FMT "%T"
#endif
#ifndef LOG_DATETIME_SEP
#define LOG_DATETIME_SEP ""
#endif
#ifndef LOG_PRINT_TIMER
#define LOG_PRINT_TIMER true
#endif
#ifndef LOG_VERB
#define LOG_VERB 1
#endif
#if LOG_PRINT_TIMER == true && (LOG_PRINT_DATE == true || LOG_PRINT_TIME == true)
#warning Printing timer and datetime both is not possible, datetime will be discarded
#define LOG_PRINT_DATE false
#define LOG_PRINT_TIME false
#endif
enum LogLevel_t {
INFO = 3,
WARNING = 2,
ERROR = 0,
TRACE = 7
};
#define TIMER
#define DATE
#define TIME
#define SEPARATOR
#define FNAME
#define LVL(lvl)
#define STREAM(lvl) \
((lvl) == TRACE || (lvl) == ERROR) ? std::cerr : std::cout
#if LOG_PRINT_TIMER == true
#define TIMER << "[" << std::fixed << Log::getTimer() << "] "
#endif
#if LOG_PRINT_DATE == true
#define DATE << Log::getTimeFmt(LOG_DATE_FMT) << " "
#endif
#if LOG_PRINT_TIME == true
#define TIME << Log::getTimeFmt(LOG_TIME_FMT) << " "
#endif
#if LOG_PRINT_DATE == true && LOG_PRINT_TIME == true
#define SEPARATOR << LOG_DATETIME_SEP
#endif
#if LOG_PRINT_FNAME == true
#define FNAME << __FUNCTION__ << ": "
#endif
#if LOG_PRINT_LVL == true
#define LVL(lvl) << #lvl << ": "
#endif
#define LOG(lvl) \
std::cout.precision(5); \
STREAM(lvl) TIMER DATE SEPARATOR TIME LVL(lvl) FNAME