diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2012-11-26 16:39:46 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-01-18 01:15:54 -0500 |
commit | e429981ba45894fe51d93956278badb61311bb99 (patch) | |
tree | db0115daf522f0c1abc4de913d1cbbdaeca23926 /src/shared/log.c | |
parent | 41a79f1062d77f95248b92b91b3b788f886aa93f (diff) |
share/log: skip file/line/func info if empty
The new microhttpd logger doesn't know this information. It is
better to log nothing than fake values.
Diffstat (limited to 'src/shared/log.c')
-rw-r--r-- | src/shared/log.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/shared/log.c b/src/shared/log.c index b39b5acb5b..293c261f9e 100644 --- a/src/shared/log.c +++ b/src/shared/log.c @@ -448,16 +448,22 @@ static int log_do_header(char *header, size_t size, snprintf(header, size, "PRIORITY=%i\n" "SYSLOG_FACILITY=%i\n" - "CODE_FILE=%s\n" - "CODE_LINE=%i\n" - "CODE_FUNCTION=%s\n" + "%s%.*s%s" + "%s%.*i%s" + "%s%.*s%s" "%s%.*s%s" "SYSLOG_IDENTIFIER=%s\n", LOG_PRI(level), LOG_FAC(level), - file, - line, - func, + file ? "CODE_FILE=" : "", + file ? LINE_MAX : 0, file, /* %.0s means no output */ + file ? "\n" : "", + line ? "CODE_LINE=" : "", + line ? 1 : 0, line, /* %.0d means no output too, special case for 0 */ + line ? "\n" : "", + func ? "CODE_FUNCTION=" : "", + func ? LINE_MAX : 0, func, + func ? "\n" : "", object ? object_name : "", object ? LINE_MAX : 0, object, /* %.0s means no output */ object ? "\n" : "", |