summaryrefslogtreecommitdiff
path: root/lib/log.c
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2018-10-03 00:19:11 +0200
committerDavid Lamparter <equinox@opensourcerouting.org>2018-10-03 23:24:24 +0200
commit65bf704b397b4d2a30c8bc3c5ea3c74fccbadc85 (patch)
treefa8a4f19d5a128adb396036ffeb85a97838c3dbc /lib/log.c
parent9b00962886a6958c2c2c65370c3a56f862fb0e9c (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.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/log.c b/lib/log.c
index b067018e08..5f0bbff2a2 100644
--- a/lib/log.c
+++ b/lib/log.c
@@ -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;