[CRIU] [PATCH criu-compel] criu: call compel_log_init() at start
Dmitry Safonov
dsafonov at virtuozzo.com
Tue Nov 8 08:55:08 PST 2016
Otherwise, messages printed by libcompel are omitted from logs.
Cc: Cyrill Gorcunov <gorcunov at openvz.org>
Signed-off-by: Dmitry Safonov <dsafonov at virtuozzo.com>
---
criu/crtools.c | 1 +
criu/include/log.h | 4 ++++
criu/log.c | 4 ++--
3 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/criu/crtools.c b/criu/crtools.c
index 8fc6a2311e7d..16c980799db9 100644
--- a/criu/crtools.c
+++ b/criu/crtools.c
@@ -691,6 +691,7 @@ int main(int argc, char *argv[], char *envp[])
if (log_init(opts.output))
return 1;
+ compel_log_init(vprint_on_level, log_get_loglevel());
pr_debug("Version: %s (gitid %s)\n", CRIU_VERSION, CRIU_GITID);
if (opts.deprecated_ok)
diff --git a/criu/include/log.h b/criu/include/log.h
index 055e8d6a43ec..f4d04c030370 100644
--- a/criu/include/log.h
+++ b/criu/include/log.h
@@ -7,6 +7,10 @@
#include <string.h>
#include <errno.h>
+#include <stdarg.h>
+
+extern void vprint_on_level(unsigned int loglevel, const char *format,
+ va_list params);
#endif /* CR_NOGLIBC */
diff --git a/criu/log.c b/criu/log.c
index 4174355cff6e..da116695eb92 100644
--- a/criu/log.c
+++ b/criu/log.c
@@ -202,7 +202,7 @@ unsigned int log_get_loglevel(void)
return current_loglevel;
}
-static void __print_on_level(unsigned int loglevel, const char *format, va_list params)
+void vprint_on_level(unsigned int loglevel, const char *format, va_list params)
{
int fd, size, ret, off = 0;
int __errno = errno;
@@ -238,7 +238,7 @@ void print_on_level(unsigned int loglevel, const char *format, ...)
va_list params;
va_start(params, format);
- __print_on_level(loglevel, format, params);
+ vprint_on_level(loglevel, format, params);
va_end(params);
}
--
2.10.2
More information about the CRIU
mailing list