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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user