mirror of
https://github.com/owntone/owntone-server.git
synced 2025-03-30 01:03:44 -04:00
log severity in logfile and console
This commit is contained in:
parent
2879458e98
commit
6a2dc2d538
@ -44,6 +44,7 @@ static int console;
|
|||||||
static char *logfilename;
|
static char *logfilename;
|
||||||
static FILE *logfile;
|
static FILE *logfile;
|
||||||
static char *labels[] = { "config", "daap", "db", "httpd", "main", "mdns", "misc", "rsp", "scan", "xcode", "event", "remote", "dacp", "ffmpeg", "artwork", "player", "raop", "laudio", "dmap", "dbperf", "spotify", "lastfm", "cache" };
|
static char *labels[] = { "config", "daap", "db", "httpd", "main", "mdns", "misc", "rsp", "scan", "xcode", "event", "remote", "dacp", "ffmpeg", "artwork", "player", "raop", "laudio", "dmap", "dbperf", "spotify", "lastfm", "cache" };
|
||||||
|
static char *severities[] = { "FATAL", "ERROR", "WARN", "INFO", "DEBUG", "SPAM" };
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -104,7 +105,7 @@ vlogger(int severity, int domain, const char *fmt, va_list args)
|
|||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
stamp[0] = '\0';
|
stamp[0] = '\0';
|
||||||
|
|
||||||
fprintf(logfile, "[%s] %8s: ", stamp, labels[domain]);
|
fprintf(logfile, "[%s] [%5s] %8s: ", stamp, severities[severity], labels[domain]);
|
||||||
|
|
||||||
va_copy(ap, args);
|
va_copy(ap, args);
|
||||||
vfprintf(logfile, fmt, ap);
|
vfprintf(logfile, fmt, ap);
|
||||||
@ -115,7 +116,7 @@ vlogger(int severity, int domain, const char *fmt, va_list args)
|
|||||||
|
|
||||||
if (console)
|
if (console)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%8s: ", labels[domain]);
|
fprintf(stderr, "[%5s] %8s: ", severities[severity], labels[domain]);
|
||||||
|
|
||||||
va_copy(ap, args);
|
va_copy(ap, args);
|
||||||
vfprintf(stderr, fmt, ap);
|
vfprintf(stderr, fmt, ap);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user