Log Colors

Added colored output to the logs. Also added the logs to zone for
outputting errors using our logger instead of printf().
This commit is contained in:
2024-02-10 11:22:30 -05:00
parent 7b32a08add
commit 75b5767e36
2 changed files with 6 additions and 6 deletions

View File

@@ -14,10 +14,9 @@ typedef enum level_color {
} level_color;
void send_to_console(const char *message, level_color color) {
// TODO: Make use of the color we are passing in so that we can color the
// output on the console
const char *color_strings[] = {"41;97", "0;91", "0;93", "0;94", "0;92"};
printf("%s", message);
printf("\033[%sm%s\033[0m\n", color_strings[color], message);
}
void send_to_error_log(const char *message) {
@@ -48,7 +47,7 @@ void log_output(log_level level, const char *message, ...) {
// Now we prepend the message with our message level
char log_message[msg_length];
sprintf(log_message, "%s%s\n", level_strings[level], format_message);
sprintf(log_message, "%s%s", level_strings[level], format_message);
// Now we call the appropriate function depending on the level
if (level <= 1) {