diff options
| author | David Lamparter <equinox@opensourcerouting.org> | 2018-10-03 00:19:11 +0200 |
|---|---|---|
| committer | David Lamparter <equinox@opensourcerouting.org> | 2018-10-03 23:24:24 +0200 |
| commit | 65bf704b397b4d2a30c8bc3c5ea3c74fccbadc85 (patch) | |
| tree | fa8a4f19d5a128adb396036ffeb85a97838c3dbc /lib/log.c | |
| parent | 9b00962886a6958c2c2c65370c3a56f862fb0e9c (diff) | |
lib: add "log error-code" switch
Signed-off-by: David Lamparter <equinox@diac24.net>
Diffstat (limited to 'lib/log.c')
| -rw-r--r-- | lib/log.c | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -684,6 +684,23 @@ ZLOG_FUNC(zlog_debug, LOG_DEBUG) #undef ZLOG_FUNC +void zlog_err_id(uint32_t id, const char *format, ...) +{ + va_list args; + va_start(args, format); + if (zlog_default && zlog_default->error_code) { + char newfmt[strlen(format) + 32]; + + snprintf(newfmt, sizeof(newfmt), "[EC %"PRIu32"] %s", id, + format); + vzlog(LOG_ERR, newfmt, args); + } else { + vzlog(LOG_ERR, format, args); + } + va_end(args); +} + + void zlog_thread_info(int log_level) { struct thread *tc; |
