wslog: Slight color and format change

This changes color use to be the very similar with GLib to
maintain familiarity. The only difference is that Message
and Info use a different color than Debug.

Also use the more familiar format of <domain> <level> instead
of <level> <domain>.
This commit is contained in:
João Valverde 2021-06-23 01:19:31 +01:00
parent a59501c0a3
commit eb3417e38f
1 changed files with 7 additions and 9 deletions

View File

@ -602,16 +602,14 @@ static inline const char *msg_color_on(gboolean enable, enum ws_log_level level)
if (!enable)
return "";
if (level <= LOG_LEVEL_NOISY)
return MAGENTA;
else if (level <= LOG_LEVEL_DEBUG)
if (level <= LOG_LEVEL_DEBUG)
return GREEN;
else if (level <= LOG_LEVEL_INFO)
return CYAN;
else if (level <= LOG_LEVEL_MESSAGE)
return BLUE;
return CYAN;
else if (level <= LOG_LEVEL_WARNING)
return YELLOW;
else if (level <= LOG_LEVEL_CRITICAL)
return MAGENTA;
else if (level <= LOG_LEVEL_ERROR)
return RED;
else
@ -648,10 +646,10 @@ static void log_write_do_work(FILE *fp, gboolean use_color, const char *timestam
}
/* Message priority (domain/level) */
fprintf(fp, "[%s%s%s %s] ", msg_color_on(use_color, level),
fprintf(fp, "[%s %s%s%s] ", domain_str,
msg_color_on(use_color, level),
level_str,
color_off(use_color),
domain_str);
color_off(use_color));
/* File/line */
if (doextra && file != NULL && line >= 0)