[CRIU] [PATCH 3/3] criu: derive log levels from compel

Kir Kolyshkin kir at openvz.org
Thu Feb 9 20:03:50 PST 2017


criu and compel are using same values for log levels. For example,
it makes it possible for criu to use its own loglevel to set the
log level for compel.

Instead of pretending it's just a coincidence, let criu derive
log levels from compel.

Signed-off-by: Kir Kolyshkin <kir at openvz.org>
---
 criu/include/log.h | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/criu/include/log.h b/criu/include/log.h
index 9c4c283..62868f6 100644
--- a/criu/include/log.h
+++ b/criu/include/log.h
@@ -2,6 +2,7 @@
 #define __CR_LOG_H__
 
 #include <inttypes.h>
+#include <compel/loglevels.h>
 
 #ifndef CR_NOGLIBC
 
@@ -15,11 +16,13 @@ extern void vprint_on_level(unsigned int loglevel, const char *format,
 #endif /* CR_NOGLIBC */
 
 #define LOG_UNSET	(-1)
-#define LOG_MSG		(0) /* Print message regardless of log level */
-#define LOG_ERROR	(1) /* Errors only, when we're in trouble */
-#define LOG_WARN	(2) /* Warnings, dazen and confused but trying to continue */
-#define LOG_INFO	(3) /* Informative, everything is fine */
-#define LOG_DEBUG	(4) /* Debug only */
+
+/* Derive the values from compel */
+#define LOG_MSG		COMPEL_LOG_MSG
+#define LOG_ERROR	COMPEL_LOG_ERROR
+#define LOG_WARN	COMPEL_LOG_WARN
+#define LOG_INFO	COMPEL_LOG_INFO
+#define LOG_DEBUG	COMPEL_LOG_DEBUG
 
 #define DEFAULT_LOGLEVEL	LOG_WARN
 
-- 
2.9.3



More information about the CRIU mailing list