diff options
author | Lennart Poettering <lennart@poettering.net> | 2016-12-12 00:02:01 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-12 00:02:01 +0100 |
commit | 161f1ee134ed405c2d87a0dcae4ae0d0882779b4 (patch) | |
tree | e96d4061a312c23486b6f4bbf9523bdaf32b9eec /src/basic/log.c | |
parent | 15ffcc3456e054c0f9fd293afe449fed292b5d38 (diff) | |
parent | b457b33ddc4f25b51880b5c2d575cc61fa14faf3 (diff) |
Merge pull request #4867 from keszybz/catalog-messages
Catalog message improvements
Diffstat (limited to 'src/basic/log.c')
-rw-r--r-- | src/basic/log.c | 35 |
1 files changed, 13 insertions, 22 deletions
diff --git a/src/basic/log.c b/src/basic/log.c index f5cff4cc9f..71d5a0baa2 100644 --- a/src/basic/log.c +++ b/src/basic/log.c @@ -500,7 +500,7 @@ static int log_do_header( line ? "CODE_LINE=" : "", line ? 1 : 0, line, /* %.0d means no output too, special case for 0 */ line ? "\n" : "", - isempty(func) ? "" : "CODE_FUNCTION=", + isempty(func) ? "" : "CODE_FUNC=", isempty(func) ? "" : func, isempty(func) ? "" : "\n", error ? "ERRNO=" : "", @@ -1134,8 +1134,8 @@ int log_syntax_internal( PROTECT_ERRNO; char buffer[LINE_MAX]; - int r; va_list ap; + const char *unit_fmt = NULL; if (error < 0) error = -error; @@ -1154,24 +1154,15 @@ int log_syntax_internal( va_end(ap); if (unit) - r = log_struct_internal( - level, error, - file, line, func, - getpid() == 1 ? "UNIT=%s" : "USER_UNIT=%s", unit, - LOG_MESSAGE_ID(SD_MESSAGE_INVALID_CONFIGURATION), - "CONFIG_FILE=%s", config_file, - "CONFIG_LINE=%u", config_line, - LOG_MESSAGE("[%s:%u] %s", config_file, config_line, buffer), - NULL); - else - r = log_struct_internal( - level, error, - file, line, func, - LOG_MESSAGE_ID(SD_MESSAGE_INVALID_CONFIGURATION), - "CONFIG_FILE=%s", config_file, - "CONFIG_LINE=%u", config_line, - LOG_MESSAGE("[%s:%u] %s", config_file, config_line, buffer), - NULL); - - return r; + unit_fmt = getpid() == 1 ? "UNIT=%s" : "USER_UNIT=%s"; + + return log_struct_internal( + level, error, + file, line, func, + LOG_MESSAGE_ID(SD_MESSAGE_INVALID_CONFIGURATION), + "CONFIG_FILE=%s", config_file, + "CONFIG_LINE=%u", config_line, + LOG_MESSAGE("%s:%u: %s", config_file, config_line, buffer), + unit_fmt, unit, + NULL); } |