Commit 24887c6e authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

log: Add generic __print_on_level helper

It accepts va_list argument and suitable to
be wrapped with another helpers.
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent c406ccc0
......@@ -152,9 +152,8 @@ unsigned int log_get_loglevel(void)
return current_loglevel;
}
void print_on_level(unsigned int loglevel, const char *format, ...)
static void __print_on_level(unsigned int loglevel, const char *format, va_list params)
{
va_list params;
int fd, size, ret, off;
if (unlikely(loglevel == LOG_MSG)) {
......@@ -168,10 +167,7 @@ void print_on_level(unsigned int loglevel, const char *format, ...)
off = 0;
}
va_start(params, format);
size = vsnprintf(buffer + buf_off, PAGE_SIZE - buf_off, format, params);
va_end(params);
size = vsnprintf(buffer + buf_off, PAGE_SIZE - buf_off, format, params);
size += buf_off;
while (off < size) {
......@@ -181,3 +177,12 @@ void print_on_level(unsigned int loglevel, const char *format, ...)
off += ret;
}
}
void print_on_level(unsigned int loglevel, const char *format, ...)
{
va_list params;
va_start(params, format);
__print_on_level(loglevel, format, params);
va_end(params);
}
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