[CRIU] [PATCH] criu: remap soccr log levels to criu levels

Andrei Vagin avagin at openvz.org
Wed Nov 22 03:59:03 MSK 2017


criu and soccr has different values for log levels, so
someone has to remap them.

Cc: Cyrill Gorcunov <gorcunov at openvz.org>
Reported-by: Cyrill Gorcunov <gorcunov at openvz.org>
Signed-off-by: Andrei Vagin <avagin at openvz.org>
---
 criu/crtools.c | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/criu/crtools.c b/criu/crtools.c
index ebfd1d6a7..741b7b2eb 100644
--- a/criu/crtools.c
+++ b/criu/crtools.c
@@ -208,6 +208,28 @@ bool deprecated_ok(char *what)
 	return false;
 }
 
+static void soccr_print_on_level(unsigned int loglevel, const char *format, ...)
+{
+	va_list args;
+	int lv;
+
+	switch (loglevel) {
+	case SOCCR_LOG_DBG:
+		lv = LOG_DEBUG;
+		break;
+	case SOCCR_LOG_ERR:
+		lv = LOG_ERROR;
+		break;
+	default:
+		lv = LOG_INFO;
+		break;
+	}
+
+	va_start(args, format);
+	vprint_on_level(lv, format, args);
+	va_end(args);
+}
+
 int main(int argc, char *argv[], char *envp[])
 {
 
@@ -688,7 +710,7 @@ int main(int argc, char *argv[], char *envp[])
 
 	if (log_init(opts.output))
 		return 1;
-	libsoccr_set_log(log_level, print_on_level);
+	libsoccr_set_log(log_level, soccr_print_on_level);
 	compel_log_init(vprint_on_level, log_get_loglevel());
 
 	pr_debug("Version: %s (gitid %s)\n", CRIU_VERSION, CRIU_GITID);
-- 
2.13.6



More information about the CRIU mailing list