summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3eeb4d5)
raw | patch | inline | side by side (parent: 3eeb4d5)
author | Sebastian Harl <sh@tokkee.org> | |
Tue, 4 Nov 2014 22:35:27 +0000 (23:35 +0100) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Tue, 4 Nov 2014 22:35:27 +0000 (23:35 +0100) |
This function is like sdb_log() but accept a va_list.
src/include/utils/error.h | patch | blob | history | |
src/utils/error.c | patch | blob | history |
index 2c3df32ff48a98c2fe7f26e03fe1593c55acbb82..49034eb2544381061583c33d4174e9fb9089e80e 100644 (file)
#ifndef SDB_UTILS_ERROR_H
#define SDB_UTILS_ERROR_H 1
+#include <stdarg.h>
#include <stddef.h>
#ifdef __cplusplus
sdb_error_set_logger(int (*f)(int, const char *));
/*
- * sdb_log:
+ * sdb_log, sdb_vlog:
* Log the specified message. The string will be formatted in printf-style
* using the specified format and arguments and logged with the specified
* priority. In addition, the error message will be stored as the current
int
sdb_log(int prio, const char *fmt, ...)
__attribute__((format(printf, 2, 3)));
+int
+sdb_vlog(int prio, const char *fmt, va_list ap);
/*
* sdb_error_set, sdb_error_append:
diff --git a/src/utils/error.c b/src/utils/error.c
index f40e31ada656f24e4719783bbe279cf49cfb7be2..f4ff99a8def3d847dcabb4143f50192f3e7450c2 100644 (file)
--- a/src/utils/error.c
+++ b/src/utils/error.c
int ret;
va_start(ap, fmt);
- ret = sdb_error_vprintf(fmt, ap);
+ ret = sdb_vlog(prio, fmt, ap);
va_end(ap);
+ return ret;
+} /* sdb_log */
+int
+sdb_vlog(int prio, const char *fmt, va_list ap)
+{
+ int ret = sdb_error_vprintf(fmt, ap);
if (ret > 0)
sdb_do_log(prio);
return ret;
-} /* sdb_log */
+} /* sdb_vlog */
int
sdb_error_set(const char *fmt, ...)