Change logger to use critical and fatal instead of error
This commit is contained in:
@@ -18,7 +18,10 @@
|
||||
#include <sys/times.h>
|
||||
#include <sys/unistd.h>
|
||||
|
||||
#ifdef LOGGER_LEVEL_ERROR
|
||||
#if LOGGER_LEVEL_FATAL
|
||||
#define LOGGER_LEVEL 5
|
||||
#endif
|
||||
#ifdef LOGGER_LEVEL_CRITICAL
|
||||
#define LOGGER_LEVEL 4
|
||||
#endif
|
||||
#ifdef LOGGER_LEVEL_WARN
|
||||
@@ -66,37 +69,44 @@
|
||||
|
||||
#if LOGGER_USE_COLOR == 1
|
||||
#define LOG_RESET_COLOR "\033[0m"
|
||||
#define LOG_COLOR_E "\033[0;31m" // Red
|
||||
#define LOG_COLOR_F "\033[0;31m" // Red
|
||||
#define LOG_COLOR_C "\033[0;31m" // Red
|
||||
#define LOG_COLOR_W "\033[0;33m" // Brown
|
||||
#define LOG_COLOR_I "\033[0;32m" // Green
|
||||
#define LOG_COLOR_D LOG_RESET_COLOR // Default
|
||||
#else
|
||||
#define LOG_RESET_COLOR
|
||||
#define LOG_COLOR_E
|
||||
#define LOG_COLOR_F
|
||||
#define LOG_COLOR_C
|
||||
#define LOG_COLOR_W
|
||||
#define LOG_COLOR_I
|
||||
#define LOG_COLOR_D
|
||||
#endif
|
||||
|
||||
#if LOGGER_LEVEL <= 1
|
||||
#define LOG_DEBUG(tag, fmt, ...) printf(LOG_Color_D"[Debug] (%lu) [%s]: "fmt LOG_RESET_COLOR, logger_get_timestamp(), tag, ##__VA_ARGS__)
|
||||
#define LOG_DEBUG(tag, fmt, ...) printf(LOG_Color_D"[Debug] (%lu) [%s]: "fmt LOG_RESET_COLOR, logger_get_timestamp(), tag, ##__VA_ARGS__)
|
||||
#else
|
||||
#define LOG_DEBUG(tag, fmt, ...)
|
||||
#endif
|
||||
#if LOGGER_LEVEL <= 2
|
||||
#define LOG_INFO(tag, fmt, ...) printf(LOG_COLOR_I"[Info] (%lu) [%s]: "fmt LOG_RESET_COLOR, logger_get_timestamp(), tag, ##__VA_ARGS__)
|
||||
#define LOG_INFO(tag, fmt, ...) printf(LOG_COLOR_I"[Info] (%lu) [%s]: "fmt LOG_RESET_COLOR, logger_get_timestamp(), tag, ##__VA_ARGS__)
|
||||
#else
|
||||
#define LOG_INFO(tag, fmt, ...)
|
||||
#endif
|
||||
#if LOGGER_LEVEL <= 3
|
||||
#define LOG_WARN(tag, fmt, ...) printf(LOG_COLOR_W"[Warning] (%lu) [%s]: "fmt LOG_RESET_COLOR, logger_get_timestamp(), tag, ##__VA_ARGS__)
|
||||
#define LOG_WARN(tag, fmt, ...) printf(LOG_COLOR_W"[Warning] (%lu) [%s]: "fmt LOG_RESET_COLOR, logger_get_timestamp(), tag, ##__VA_ARGS__)
|
||||
#else
|
||||
#define LOG_WARN(tag, fmt, ...)
|
||||
#endif
|
||||
#if LOGGER_LEVEL <= 4
|
||||
#define LOG_ERROR(tag, fmt, ...) printf(LOG_COLOR_E"[Error] (%lu) [%s]: "fmt LOG_RESET_COLOR, logger_get_timestamp(), tag, ##__VA_ARGS__)
|
||||
#define LOG_CRIT(tag, fmt, ...) printf(LOG_COLOR_C"[Critical] (%lu) [%s]: "fmt LOG_RESET_COLOR, logger_get_timestamp(), tag, ##__VA_ARGS__)
|
||||
#else
|
||||
#define LOG_ERROR(tag, fmt, ...)
|
||||
#define LOG_CRIT(tag, fmt, ...)
|
||||
#endif
|
||||
#if LOGGER_LEVEL <= 4
|
||||
#define LOG_FATAL(tag, fmt, ...) printf(LOG_COLOR_F"[Fatal] (%lu) [%s]: "fmt LOG_RESET_COLOR, logger_get_timestamp(), tag, ##__VA_ARGS__)
|
||||
#else
|
||||
#define LOG_FATAL(tag, fmt, ...)
|
||||
#endif
|
||||
|
||||
/* For internal use only.
|
||||
|
||||
Reference in New Issue
Block a user