Commit 29c00f41 authored by Adrien Béraud's avatar Adrien Béraud

logger: add vlogger with va_list

Change-Id: I4203235cd16eec796ecd020ecfe06e9b8107fc10
parent a988a186
......@@ -44,6 +44,15 @@ void logger(const int level, const char* format, ...)
return;
va_list ap;
va_start(ap, format);
vlogger(level, format, ap);
va_end(ap);
}
void vlogger(const int level, const char *format, va_list ap)
{
if (!debugMode && level == LOG_DEBUG)
return;
if (consoleLog) {
const char *color_prefix = "";
......@@ -58,16 +67,10 @@ void logger(const int level, const char* format, ...)
}
fputs(color_prefix, stderr);
va_start(ap, format);
vfprintf(stderr, format, ap);
va_end(ap);
fputs(END_COLOR"\n", stderr);
} else {
va_start(ap, format);
vsyslog(level, format, ap);
va_end(ap);
}
}
......
......@@ -35,10 +35,13 @@
extern "C" {
#endif
#include <stdarg.h>
/**
* Print something, coloring it depending on the level
*/
void logger(const int level, const char *format, ...);
void vlogger(const int level, const char *format, va_list);
/**
* Allow writing on the console
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment