From: Stéphane Graber Date: Wed, 5 Feb 2014 20:18:21 +0000 (-0500) Subject: log: Set log_define properly X-Git-Tag: lxc-1.0.0.beta4~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6ea518f64a0bd5b73a2e43ac1d36b0874a32f5df;p=thirdparty%2Flxc.git log: Set log_define properly This sets lxc_log_define to what should be appropriate values for all existing binaries that call lxc_log_init. The name is lxc__ui for anything that's user visible and lxc_ for anything that's not. The parent is set to "lxc" for anything using the API and to the matching C file name for anything that isn't. Signed-off-by: Stéphane Graber Signed-off-by: Serge Hallyn --- diff --git a/src/lxc/lxc_autostart.c b/src/lxc/lxc_autostart.c index b03de4f58..ed6229462 100644 --- a/src/lxc/lxc_autostart.c +++ b/src/lxc/lxc_autostart.c @@ -27,6 +27,8 @@ #include "list.h" #include "log.h" +lxc_log_define(lxc_autostart_ui, lxc); + static int my_parser(struct lxc_arguments* args, int c, char* arg) { switch (c) { @@ -221,6 +223,11 @@ int main(int argc, char *argv[]) if (lxc_arguments_parse(&my_args, argc, argv)) return 1; + if (lxc_log_init(my_args.name, my_args.log_file, my_args.log_priority, + my_args.progname, my_args.quiet, my_args.lxcpath[0])) + return 1; + lxc_log_options_no_override(); + count = list_defined_containers(NULL, NULL, &containers); if (count < 0) diff --git a/src/lxc/lxc_cgroup.c b/src/lxc/lxc_cgroup.c index b7fc621e2..a3cd2b7e5 100644 --- a/src/lxc/lxc_cgroup.c +++ b/src/lxc/lxc_cgroup.c @@ -32,7 +32,7 @@ #include "log.h" #include "arguments.h" -lxc_log_define(lxc_cgroup_ui, lxc_cgroup); +lxc_log_define(lxc_cgroup_ui, lxc); static int my_checker(const struct lxc_arguments* args) { diff --git a/src/lxc/lxc_clone.c b/src/lxc/lxc_clone.c index ea2d16f0e..d7e6bc93d 100644 --- a/src/lxc/lxc_clone.c +++ b/src/lxc/lxc_clone.c @@ -36,7 +36,7 @@ #include "conf.h" #include "state.h" -lxc_log_define(lxc_clone, lxc); +lxc_log_define(lxc_clone_ui, lxc); /* we pass fssize in bytes */ static uint64_t get_fssize(char *s) diff --git a/src/lxc/lxc_console.c b/src/lxc/lxc_console.c index c262ada91..bfee6fb57 100644 --- a/src/lxc/lxc_console.c +++ b/src/lxc/lxc_console.c @@ -47,7 +47,7 @@ #include "arguments.h" #include "commands.h" -lxc_log_define(lxc_console_ui, lxc_console); +lxc_log_define(lxc_console_ui, lxc); static char etoc(const char *expr) { diff --git a/src/lxc/lxc_create.c b/src/lxc/lxc_create.c index 87845b4ad..a3684c16f 100644 --- a/src/lxc/lxc_create.c +++ b/src/lxc/lxc_create.c @@ -33,7 +33,7 @@ #include "arguments.h" #include "utils.h" -lxc_log_define(lxc_create, lxc); +lxc_log_define(lxc_create_ui, lxc); static uint64_t get_fssize(char *s) { diff --git a/src/lxc/lxc_destroy.c b/src/lxc/lxc_destroy.c index cd56f0824..d8bca345b 100644 --- a/src/lxc/lxc_destroy.c +++ b/src/lxc/lxc_destroy.c @@ -29,7 +29,7 @@ #include "arguments.h" #include "utils.h" -lxc_log_define(lxc_destroy, lxc); +lxc_log_define(lxc_destroy_ui, lxc); static int my_parser(struct lxc_arguments* args, int c, char* arg) { diff --git a/src/lxc/lxc_execute.c b/src/lxc/lxc_execute.c index 18baa064f..2ba4aeb68 100644 --- a/src/lxc/lxc_execute.c +++ b/src/lxc/lxc_execute.c @@ -41,7 +41,7 @@ #include "start.h" #include "utils.h" -lxc_log_define(lxc_execute_ui, lxc_execute); +lxc_log_define(lxc_execute_ui, lxc); static struct lxc_list defines; diff --git a/src/lxc/lxc_freeze.c b/src/lxc/lxc_freeze.c index bb01a3a16..fa64963e2 100644 --- a/src/lxc/lxc_freeze.c +++ b/src/lxc/lxc_freeze.c @@ -33,7 +33,7 @@ #include "arguments.h" -lxc_log_define(lxc_freeze_ui, lxc_cgroup); +lxc_log_define(lxc_freeze_ui, lxc); static const struct option my_longopts[] = { LXC_COMMON_OPTIONS diff --git a/src/lxc/lxc_info.c b/src/lxc/lxc_info.c index b556c2c01..96cb9663c 100644 --- a/src/lxc/lxc_info.c +++ b/src/lxc/lxc_info.c @@ -37,6 +37,8 @@ #include "commands.h" #include "arguments.h" +lxc_log_define(lxc_info_ui, lxc); + static bool ips; static bool state; static bool pid; diff --git a/src/lxc/lxc_monitor.c b/src/lxc/lxc_monitor.c index fa954dcc5..7e2299ab2 100644 --- a/src/lxc/lxc_monitor.c +++ b/src/lxc/lxc_monitor.c @@ -34,7 +34,7 @@ #include "monitor.h" #include "arguments.h" -lxc_log_define(lxc_monitor_ui, lxc_monitor); +lxc_log_define(lxc_monitor_ui, lxc); static bool quit_monitord; diff --git a/src/lxc/lxc_snapshot.c b/src/lxc/lxc_snapshot.c index a8d4e7fc1..75c422341 100644 --- a/src/lxc/lxc_snapshot.c +++ b/src/lxc/lxc_snapshot.c @@ -33,7 +33,7 @@ #include "arguments.h" #include "utils.h" -lxc_log_define(lxc_snapshot, lxc); +lxc_log_define(lxc_snapshot_ui, lxc); static char *newname; static char *snapshot; diff --git a/src/lxc/lxc_start.c b/src/lxc/lxc_start.c index 9517fe6f4..05fb16113 100644 --- a/src/lxc/lxc_start.c +++ b/src/lxc/lxc_start.c @@ -55,7 +55,7 @@ #define OPT_SHARE_IPC OPT_USAGE+2 #define OPT_SHARE_UTS OPT_USAGE+3 -lxc_log_define(lxc_start_ui, lxc_start); +lxc_log_define(lxc_start_ui, lxc); static struct lxc_list defines; diff --git a/src/lxc/lxc_stop.c b/src/lxc/lxc_stop.c index fc9d70a84..78a1da2fa 100644 --- a/src/lxc/lxc_stop.c +++ b/src/lxc/lxc_stop.c @@ -36,6 +36,8 @@ #define OPT_NO_LOCK OPT_USAGE+1 #define OPT_NO_KILL OPT_USAGE+2 +lxc_log_define(lxc_stop_ui, lxc); + static int my_parser(struct lxc_arguments* args, int c, char* arg) { switch (c) { diff --git a/src/lxc/lxc_unfreeze.c b/src/lxc/lxc_unfreeze.c index e66d165bb..737198030 100644 --- a/src/lxc/lxc_unfreeze.c +++ b/src/lxc/lxc_unfreeze.c @@ -31,7 +31,7 @@ #include "log.h" #include "arguments.h" -lxc_log_define(lxc_unfreeze_ui, lxc_cgroup); +lxc_log_define(lxc_unfreeze_ui, lxc); static const struct option my_longopts[] = { LXC_COMMON_OPTIONS diff --git a/src/lxc/lxc_wait.c b/src/lxc/lxc_wait.c index d34c5e739..e1010e290 100644 --- a/src/lxc/lxc_wait.c +++ b/src/lxc/lxc_wait.c @@ -34,7 +34,7 @@ #include "log.h" #include "arguments.h" -lxc_log_define(lxc_wait_ui, lxc_monitor); +lxc_log_define(lxc_wait_ui, lxc); static int my_checker(const struct lxc_arguments* args) {