From 1c47eccd8826d4aeef6db8c9e3091c526df4431c Mon Sep 17 00:00:00 2001 From: Sander Speetjens Date: Wed, 1 Nov 2023 14:01:45 +0100 Subject: [PATCH] Change logger use color --- README.md | 2 +- project/Core/Inc/log.h | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f8264aa..e404324 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/project/Core/Inc/log.h b/project/Core/Inc/log.h index 72d206c..7716987 100644 --- a/project/Core/Inc/log.h +++ b/project/Core/Inc/log.h @@ -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