forked from osmocom/wireshark
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:
parent
a59501c0a3
commit
eb3417e38f
|
@ -602,16 +602,14 @@ static inline const char *msg_color_on(gboolean enable, enum ws_log_level level)
|
||||||
if (!enable)
|
if (!enable)
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
if (level <= LOG_LEVEL_NOISY)
|
if (level <= LOG_LEVEL_DEBUG)
|
||||||
return MAGENTA;
|
|
||||||
else if (level <= LOG_LEVEL_DEBUG)
|
|
||||||
return GREEN;
|
return GREEN;
|
||||||
else if (level <= LOG_LEVEL_INFO)
|
|
||||||
return CYAN;
|
|
||||||
else if (level <= LOG_LEVEL_MESSAGE)
|
else if (level <= LOG_LEVEL_MESSAGE)
|
||||||
return BLUE;
|
return CYAN;
|
||||||
else if (level <= LOG_LEVEL_WARNING)
|
else if (level <= LOG_LEVEL_WARNING)
|
||||||
return YELLOW;
|
return YELLOW;
|
||||||
|
else if (level <= LOG_LEVEL_CRITICAL)
|
||||||
|
return MAGENTA;
|
||||||
else if (level <= LOG_LEVEL_ERROR)
|
else if (level <= LOG_LEVEL_ERROR)
|
||||||
return RED;
|
return RED;
|
||||||
else
|
else
|
||||||
|
@ -648,10 +646,10 @@ static void log_write_do_work(FILE *fp, gboolean use_color, const char *timestam
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Message priority (domain/level) */
|
/* 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,
|
level_str,
|
||||||
color_off(use_color),
|
color_off(use_color));
|
||||||
domain_str);
|
|
||||||
|
|
||||||
/* File/line */
|
/* File/line */
|
||||||
if (doextra && file != NULL && line >= 0)
|
if (doextra && file != NULL && line >= 0)
|
||||||
|
|
Loading…
Reference in New Issue