mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-08 13:29:59 -05:00
Minor optimization: read log level character code from array
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1457 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
d949983845
commit
872018efc8
1 changed files with 12 additions and 27 deletions
|
|
@ -62,6 +62,14 @@ static const int level_to_syslog[] = {
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static const char level_to_char[] = {
|
||||||
|
[PA_LOG_ERROR] = 'E',
|
||||||
|
[PA_LOG_WARN] = 'W',
|
||||||
|
[PA_LOG_NOTICE] = 'N',
|
||||||
|
[PA_LOG_INFO] = 'I',
|
||||||
|
[PA_LOG_DEBUG] = 'D'
|
||||||
|
};
|
||||||
|
|
||||||
void pa_log_set_ident(const char *p) {
|
void pa_log_set_ident(const char *p) {
|
||||||
if (log_ident)
|
if (log_ident)
|
||||||
pa_xfree(log_ident);
|
pa_xfree(log_ident);
|
||||||
|
|
@ -129,7 +137,6 @@ void pa_log_levelv_meta(
|
||||||
switch (log_target) {
|
switch (log_target) {
|
||||||
case PA_LOG_STDERR: {
|
case PA_LOG_STDERR: {
|
||||||
const char *prefix = "", *suffix = "";
|
const char *prefix = "", *suffix = "";
|
||||||
const char *level_code = "";
|
|
||||||
char *local_t;
|
char *local_t;
|
||||||
|
|
||||||
#ifndef OS_IS_WIN32
|
#ifndef OS_IS_WIN32
|
||||||
|
|
@ -145,33 +152,11 @@ void pa_log_levelv_meta(
|
||||||
}
|
}
|
||||||
#endif
|
#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);
|
local_t = pa_utf8_to_locale(t);
|
||||||
if (!local_t) {
|
if (!local_t)
|
||||||
fprintf(stderr, "%s: %s%s%s%s\n", level_code, location,
|
fprintf(stderr, "%c: %s%s%s%s\n", level_to_char[level], location, prefix, t, suffix);
|
||||||
prefix, t, suffix);
|
else {
|
||||||
} else {
|
fprintf(stderr, "%c: %s%s%s%s\n", level_to_char[level], location, prefix, local_t, suffix);
|
||||||
fprintf(stderr, "%s: %s%s%s%s\n", level_code, location,
|
|
||||||
prefix, local_t, suffix);
|
|
||||||
pa_xfree(local_t);
|
pa_xfree(local_t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue