Prefix log lines with a character indicating level.

git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1427 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
Pierre Ossman 2007-02-14 09:26:48 +00:00
parent 06211b7c8f
commit 3016c7561d

View file

@ -129,6 +129,7 @@ void pa_log_levelv_meta(
switch (log_target) {
case PA_LOG_STDERR: {
const char *prefix = "", *suffix = "";
const char *level_code = "";
char *local_t;
#ifndef OS_IS_WIN32
@ -144,11 +145,33 @@ void pa_log_levelv_meta(
}
#endif
switch (level) {
case PA_LOG_ERROR:
level_code = "E";
break;
case PA_LOG_WARN:
level_code = "W";
break;
case PA_LOG_NOTICE:
level_code = "N";
break;
case PA_LOG_INFO:
level_code = "I";
break;
case PA_LOG_DEBUG:
level_code = "D";
break;
default:
level_code = "?";
}
local_t = pa_utf8_to_locale(t);
if (!local_t)
fprintf(stderr, "%s%s%s%s\n", location, prefix, t, suffix);
else {
fprintf(stderr, "%s%s%s%s\n", location, prefix, local_t, suffix);
if (!local_t) {
fprintf(stderr, "%s: %s%s%s%s\n", level_code, location,
prefix, t, suffix);
} else {
fprintf(stderr, "%s: %s%s%s%s\n", level_code, location,
prefix, local_t, suffix);
pa_xfree(local_t);
}