From a402541bee158bb393350affa56248fb87ef446c Mon Sep 17 00:00:00 2001 From: Junji Hashimoto Date: Thu, 27 Jun 2024 16:18:51 +0900 Subject: [PATCH 1/2] Update LOG's color with reset --- utils/logging.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/utils/logging.h b/utils/logging.h index 490769a..11b67f6 100644 --- a/utils/logging.h +++ b/utils/logging.h @@ -22,15 +22,19 @@ inline void LOG(Logger& logger, int level, const char *message, ...) { static const char *red = "\033[0;31m"; static const char *white = "\033[0;37m"; static const char *gray = "\033[0;90m"; + static const char *reset = "\033[0m"; static const char *logColors[] = {red, red, orange, gray}; if (level <= logger.level) { va_list(args); va_start(args, message); snprintf(logger.buffer, sizeof(logger.buffer), message, args); - fprintf(logger.stream, "[%s%s%s] ", logColors[level], kLevelStr[level], + // Brackets and messages are white. + // Log levells are red for error and warning, orange for info, and grey for trace. + // Then the color is reset. + fprintf(logger.stream, "%s[%s%s%s] ", white, logColors[level], kLevelStr[level], white); vfprintf(logger.stream, message, args); - fprintf(logger.stream, "\n"); + fprintf(logger.stream, "%s\n", reset); va_end(args); } } From 5137a13f854f85d47612eac344c7c1774cb25849 Mon Sep 17 00:00:00 2001 From: Austin Huang Date: Thu, 27 Jun 2024 15:17:56 -0400 Subject: [PATCH 2/2] typo fix (via PR web ui) --- utils/logging.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/logging.h b/utils/logging.h index 11b67f6..5d59966 100644 --- a/utils/logging.h +++ b/utils/logging.h @@ -29,7 +29,7 @@ inline void LOG(Logger& logger, int level, const char *message, ...) { va_start(args, message); snprintf(logger.buffer, sizeof(logger.buffer), message, args); // Brackets and messages are white. - // Log levells are red for error and warning, orange for info, and grey for trace. + // Log levels are red for error and warning, orange for info, and grey for trace. // Then the color is reset. fprintf(logger.stream, "%s[%s%s%s] ", white, logColors[level], kLevelStr[level], white);