Change logger use color
This commit is contained in:
@@ -85,7 +85,7 @@ before you include `log.h`, you can define custom log levels by defining the fol
|
||||
```
|
||||
|
||||
### Colorful Log Messages
|
||||
For improved readability, log messages can be printed in color by configuring `LOGGER_USE_COLOR` to `1` in `log.h` or before you include `log.h`. \
|
||||
For improved readability, log messages can be printed in color by defining `LOGGER_USE_COLOR` in `log.h` or before you include `log.h`. \
|
||||
Default is `0`
|
||||
|
||||
### Log Output Format
|
||||
|
||||
@@ -34,11 +34,15 @@
|
||||
#define LOGGER_LEVEL 1
|
||||
#endif
|
||||
|
||||
#ifdef LOGGER_USE_COLOR
|
||||
#define LOGGER_COLOR 1
|
||||
#endif
|
||||
|
||||
#ifndef LOGGER_LEVEL
|
||||
#define LOGGER_LEVEL 3
|
||||
#endif
|
||||
#ifndef LOGGER_USE_COLOR
|
||||
#define LOGGER_USE_COLOR 0
|
||||
#ifndef LOGGER_COLOR
|
||||
#define LOGGER_COLOR 0
|
||||
#endif
|
||||
|
||||
#define ANSI_ESC "\x1B"
|
||||
@@ -67,7 +71,7 @@
|
||||
#define ERASE_FROM_CURSOR_TO_BEGINNING_LINE ANSI_ESC "[1K"
|
||||
#define ERASE_ENTIRE_LINE ANSI_ESC "[2K"
|
||||
|
||||
#if LOGGER_USE_COLOR == 1
|
||||
#if LOGGER_COLOR == 1
|
||||
#define LOG_RESET_COLOR "\033[0m"
|
||||
#define LOG_COLOR_F "\033[0;31m" // Red
|
||||
#define LOG_COLOR_C "\033[0;31m" // Red
|
||||
|
||||
Reference in New Issue
Block a user