2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-29 13:28:27 +00:00

libcriu: define log level constants

Replace magic numbers used to set log level in libcriu
with constants.

Signed-off-by: Radostin Stoyanov <radostin@redhat.com>
This commit is contained in:
Radostin Stoyanov 2021-09-17 19:23:32 +01:00 committed by Andrei Vagin
parent 5ec2a6aaad
commit a8c5efe4c1
5 changed files with 13 additions and 6 deletions

View File

@ -28,6 +28,13 @@
extern "C" { extern "C" {
#endif #endif
#define CRIU_LOG_UNSET (-1)
#define CRIU_LOG_MSG (0) /* Print message regardless of log level */
#define CRIU_LOG_ERROR (1) /* Errors only */
#define CRIU_LOG_WARN (2) /* Warnings */
#define CRIU_LOG_INFO (3) /* Informative */
#define CRIU_LOG_DEBUG (4) /* Debug only */
enum criu_service_comm { CRIU_COMM_SK, CRIU_COMM_FD, CRIU_COMM_BIN }; enum criu_service_comm { CRIU_COMM_SK, CRIU_COMM_FD, CRIU_COMM_BIN };
enum criu_cg_mode { enum criu_cg_mode {

View File

@ -106,7 +106,7 @@ int main(int argc, char **argv)
criu_set_service_binary(argv[1]); criu_set_service_binary(argv[1]);
criu_set_pid(pid); criu_set_pid(pid);
criu_set_log_file("dump.log"); criu_set_log_file("dump.log");
criu_set_log_level(4); criu_set_log_level(CRIU_LOG_DEBUG);
open_imgdir(); open_imgdir();
ret = criu_dump_iters(next_iter); ret = criu_dump_iters(next_iter);
@ -121,7 +121,7 @@ int main(int argc, char **argv)
printf("--- Restore loop ---\n"); printf("--- Restore loop ---\n");
criu_init_opts(); criu_init_opts();
criu_set_log_level(4); criu_set_log_level(CRIU_LOG_DEBUG);
criu_set_log_file("restore.log"); criu_set_log_file("restore.log");
criu_set_images_dir_fd(cur_imgdir); criu_set_images_dir_fd(cur_imgdir);

View File

@ -71,7 +71,7 @@ int main(int argc, char **argv)
criu_set_service_binary(argv[1]); criu_set_service_binary(argv[1]);
criu_set_pid(pid); criu_set_pid(pid);
criu_set_log_file("dump.log"); criu_set_log_file("dump.log");
criu_set_log_level(4); criu_set_log_level(CRIU_LOG_DEBUG);
criu_set_notify_cb(notify); criu_set_notify_cb(notify);
fd = open(argv[2], O_DIRECTORY); fd = open(argv[2], O_DIRECTORY);
criu_set_images_dir_fd(fd); criu_set_images_dir_fd(fd);

View File

@ -37,7 +37,7 @@ int main(int argc, char *argv[])
} }
criu_set_images_dir_fd(fd); criu_set_images_dir_fd(fd);
criu_set_log_level(4); criu_set_log_level(CRIU_LOG_DEBUG);
printf("--- Start child ---\n"); printf("--- Start child ---\n");
pid = fork(); pid = fork();

View File

@ -69,7 +69,7 @@ int main(int argc, char **argv)
criu_set_service_binary(argv[1]); criu_set_service_binary(argv[1]);
criu_set_pid(pid); criu_set_pid(pid);
criu_set_log_file("dump.log"); criu_set_log_file("dump.log");
criu_set_log_level(4); criu_set_log_level(CRIU_LOG_DEBUG);
fd = open(argv[2], O_DIRECTORY); fd = open(argv[2], O_DIRECTORY);
criu_set_images_dir_fd(fd); criu_set_images_dir_fd(fd);
@ -85,7 +85,7 @@ int main(int argc, char **argv)
printf("--- Restore loop ---\n"); printf("--- Restore loop ---\n");
criu_init_opts(); criu_init_opts();
criu_set_log_level(4); criu_set_log_level(CRIU_LOG_DEBUG);
criu_set_log_file("restore.log"); criu_set_log_file("restore.log");
criu_set_images_dir_fd(fd); criu_set_images_dir_fd(fd);