]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
log: Set log_define properly
authorStéphane Graber <stgraber@ubuntu.com>
Wed, 5 Feb 2014 20:18:21 +0000 (15:18 -0500)
committerSerge Hallyn <serge.hallyn@ubuntu.com>
Wed, 5 Feb 2014 23:16:34 +0000 (17:16 -0600)
This sets lxc_log_define to what should be appropriate values for all
existing binaries that call lxc_log_init.

The name is lxc_<bin name>_ui for anything that's user visible and
lxc_<bin name> 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 <stgraber@ubuntu.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
15 files changed:
src/lxc/lxc_autostart.c
src/lxc/lxc_cgroup.c
src/lxc/lxc_clone.c
src/lxc/lxc_console.c
src/lxc/lxc_create.c
src/lxc/lxc_destroy.c
src/lxc/lxc_execute.c
src/lxc/lxc_freeze.c
src/lxc/lxc_info.c
src/lxc/lxc_monitor.c
src/lxc/lxc_snapshot.c
src/lxc/lxc_start.c
src/lxc/lxc_stop.c
src/lxc/lxc_unfreeze.c
src/lxc/lxc_wait.c

index b03de4f58f390c07a26918df4c72e1a7a0512700..ed62294626c5c0bbb96e6e39c1444f78bc9f86df 100644 (file)
@@ -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)
index b7fc621e23103b647723ef99765954cab49359ba..a3cd2b7e590d96143c9d7f19123bd6e329138c3b 100644 (file)
@@ -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)
 {
index ea2d16f0eabdf717f19e6a102932081ec47acf69..d7e6bc93d8ad660554b859a1282ce424df4f8cde 100644 (file)
@@ -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)
index c262ada919a7014e47b5f21f7743763d04706baa..bfee6fb570d7df774de1d7a8e320c6d145e4cdfe 100644 (file)
@@ -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)
 {
index 87845b4addbab7ea11ad1b842ff467b1abcb5889..a3684c16fe200d868f6420642ec7755b7c02c035 100644 (file)
@@ -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)
 {
index cd56f08249fc415303e062e87ba6e038003815f3..d8bca345b73e046551c072024d870c7eec73432b 100644 (file)
@@ -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)
 {
index 18baa064f1027395df5dc56260fec46487f92ebf..2ba4aeb68a13bc15e4821c384cb3e17542e93cc0 100644 (file)
@@ -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;
 
index bb01a3a16a38a4fd0f4e5a44467dbd7ade31133d..fa64963e2ea34e35c79e4c54bc65aab7ae02fc56 100644 (file)
@@ -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
index b556c2c01a475df9e90d18a7f6f2bd16f0e3cb01..96cb9663cb27f96a0a4118ec6762368dc9528f50 100644 (file)
@@ -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;
index fa954dcc5e0c917545322a44dbad4323cc18868d..7e2299ab22bbbd30ca11835446d1100f45b0b660 100644 (file)
@@ -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;
 
index a8d4e7fc184c7b77310e3a8ab3daa7082186396f..75c4223419fca9877ef305fe6b0270f175023e8d 100644 (file)
@@ -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;
index 9517fe6f4c5746eb937aa4fecd4828592d6c2b91..05fb1611319554ee83332f54d193dcc872b6a0c9 100644 (file)
@@ -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;
 
index fc9d70a84a19a98d2ed70a8c1caacea7ae464b73..78a1da2fabe514accab9701affee0ed372f4e177 100644 (file)
@@ -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) {
index e66d165bb8f7e0f2611d451e24df944f3d84ef53..737198030653566c8a706c2fdb7e855cc9716d7f 100644 (file)
@@ -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
index d34c5e739fcd915f3250629e6aa528d9995334b7..e1010e290be0e60f3b1a118e8d73dca1d51c9f18 100644 (file)
@@ -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)
 {