summaryrefslogtreecommitdiff
path: root/src/basic/log.h
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-04-21 12:52:54 -0400
committerSven Eden <yamakuzure@gmx.net>2017-07-25 09:46:52 +0200
commita2eca852b71b917b8444a9ce792577baa516f06b (patch)
tree29224f3134c371a18431b225738293bd428a0d72 /src/basic/log.h
parent14d2a81c8c1d4c06458c2ddcf89df28bc1de3602 (diff)
basic/log: expose log_dispatch
This is useful when we want to avoid printf formatting on the message. It's nicer than using log_struct with "%s" as the format, because printf is slow and with a large message (like from a backtrace) this would require extra unnecessary memory. I'm not exposing all the fields in the wrapper: only level and errno. Those are the most likely to be useful.
Diffstat (limited to 'src/basic/log.h')
-rw-r--r--src/basic/log.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/basic/log.h b/src/basic/log.h
index d4bc3a934..8353394ff 100644
--- a/src/basic/log.h
+++ b/src/basic/log.h
@@ -77,6 +77,18 @@ void log_close_console(void);
void log_parse_environment(void);
+int log_dispatch_internal(
+ int level,
+ int error,
+ const char *file,
+ int line,
+ const char *func,
+ const char *object_field,
+ const char *object,
+ const char *extra,
+ const char *extra_field,
+ char *buffer);
+
int log_internal(
int level,
int error,
@@ -169,6 +181,9 @@ void log_assert_failed_return(
int line,
const char *func);
+#define log_dispatch(level, error, buffer) \
+ log_dispatch_internal(level, error, __FILE__, __LINE__, __func__, NULL, NULL, NULL, NULL, buffer)
+
/* Logging with level */
#define log_full_errno(level, error, ...) \
({ \