]> git.proxmox.com Git - mirror_lxc.git/commitdiff
API: expose function lxc_log_init
author0x0916 <w@laoqinren.net>
Mon, 5 Jun 2017 06:31:03 +0000 (14:31 +0800)
committer0x0916 <w@laoqinren.net>
Tue, 6 Jun 2017 03:55:31 +0000 (11:55 +0800)
Signed-off-by: 0x0916 <w@laoqinren.net>
24 files changed:
src/lxc/log.c
src/lxc/log.h
src/lxc/lxc_monitord.c
src/lxc/lxccontainer.h
src/lxc/tools/lxc_attach.c
src/lxc/tools/lxc_autostart.c
src/lxc/tools/lxc_cgroup.c
src/lxc/tools/lxc_checkpoint.c
src/lxc/tools/lxc_console.c
src/lxc/tools/lxc_copy.c
src/lxc/tools/lxc_create.c
src/lxc/tools/lxc_destroy.c
src/lxc/tools/lxc_device.c
src/lxc/tools/lxc_execute.c
src/lxc/tools/lxc_freeze.c
src/lxc/tools/lxc_info.c
src/lxc/tools/lxc_init.c
src/lxc/tools/lxc_ls.c
src/lxc/tools/lxc_monitor.c
src/lxc/tools/lxc_snapshot.c
src/lxc/tools/lxc_start.c
src/lxc/tools/lxc_stop.c
src/lxc/tools/lxc_unfreeze.c
src/lxc/tools/lxc_wait.c

index 339b81c61cf6e31ce7cc3e71119ac69ab3fbc09f..4e7ba2da947b8f03de5f872be980e0ecd0cf3e83 100644 (file)
@@ -44,6 +44,7 @@
 #include "log.h"
 #include "caps.h"
 #include "utils.h"
+#include "lxccontainer.h"
 
 /* We're logging in seconds and nanoseconds. Assuming that the underlying
  * datatype is currently at maximum a 64bit integer, we have a date string that
@@ -543,9 +544,7 @@ extern void lxc_log_enable_syslog(void)
  * Called from lxc front-end programs (like lxc-create, lxc-start) to
  * initalize the log defaults.
  */
-extern int lxc_log_init(const char *name, const char *file,
-                       const char *priority, const char *prefix, int quiet,
-                       const char *lxcpath)
+extern int lxc_log_init(struct lxc_log *log)
 {
        int lxc_priority = LXC_LOG_PRIORITY_ERROR;
        int ret;
@@ -555,8 +554,8 @@ extern int lxc_log_init(const char *name, const char *file,
                return 0;
        }
 
-       if (priority)
-               lxc_priority = lxc_log_priority_to_int(priority);
+       if (log->priority)
+               lxc_priority = lxc_log_priority_to_int(log->priority);
 
        if (!lxc_loglevel_specified) {
                lxc_log_category_lxc.priority = lxc_priority;
@@ -564,49 +563,49 @@ extern int lxc_log_init(const char *name, const char *file,
        }
 
        if (!lxc_quiet_specified) {
-               if (!quiet)
+               if (!log->quiet)
                        lxc_log_category_lxc.appender->next = &log_appender_stderr;
        }
 
-       if (prefix)
-               lxc_log_set_prefix(prefix);
+       if (log->prefix)
+               lxc_log_set_prefix(log->prefix);
 
-       if (name)
-               log_vmname = strdup(name);
+       if (log->name)
+               log_vmname = strdup(log->name);
 
-       if (file) {
-               if (strcmp(file, "none") == 0)
+       if (log->file) {
+               if (strcmp(log->file, "none") == 0)
                        return 0;
-               ret = __lxc_log_set_file(file, 1);
+               ret = __lxc_log_set_file(log->file, 1);
                lxc_log_use_global_fd = 1;
        } else {
                /* if no name was specified, there nothing to do */
-               if (!name)
+               if (!log->name)
                        return 0;
 
                ret = -1;
 
-               if (!lxcpath)
-                       lxcpath = LOGPATH;
+               if (!log->lxcpath)
+                       log->lxcpath = LOGPATH;
 
                /* try LOGPATH if lxcpath is the default for the privileged containers */
-               if (!geteuid() && strcmp(LXCPATH, lxcpath) == 0)
-                       ret = _lxc_log_set_file(name, NULL, 0);
+               if (!geteuid() && strcmp(LXCPATH, log->lxcpath) == 0)
+                       ret = _lxc_log_set_file(log->name, NULL, 0);
 
                /* try in lxcpath */
                if (ret < 0)
-                       ret = _lxc_log_set_file(name, lxcpath, 1);
+                       ret = _lxc_log_set_file(log->name, log->lxcpath, 1);
 
                /* try LOGPATH in case its writable by the caller */
                if (ret < 0)
-                       ret = _lxc_log_set_file(name, NULL, 0);
+                       ret = _lxc_log_set_file(log->name, NULL, 0);
        }
 
        /*
         * If !file, that is, if the user did not request this logpath, then
         * ignore failures and continue logging to console
         */
-       if (!file && ret != 0) {
+       if (!log->file && ret != 0) {
                INFO("Ignoring failure to open default logfile.");
                ret = 0;
        }
index b9ee497567281ae00dc28cf295220be156c6c682..8a68c8506372e5169d094fbcbec0d927500fc16b 100644 (file)
@@ -348,10 +348,6 @@ ATTR_UNUSED static inline void LXC_##PRIORITY(struct lxc_log_locinfo* locinfo,     \
 
 extern int lxc_log_fd;
 
-extern int lxc_log_init(const char *name, const char *file,
-                       const char *priority, const char *prefix, int quiet,
-                       const char *lxcpath);
-
 extern int lxc_log_set_file(int *fd, const char *fname);
 extern int lxc_log_syslog(int facility);
 extern void lxc_log_enable_syslog(void);
index 62e212112644a5251cd622a8e4928963feff499c..0f153ea40f5c8acf9415e4527c955c3538f479de 100644 (file)
@@ -44,6 +44,7 @@
 #include "mainloop.h"
 #include "monitor.h"
 #include "utils.h"
+#include "lxccontainer.h"
 
 #define CLIENTFDS_CHUNK 64
 
@@ -350,6 +351,7 @@ int main(int argc, char *argv[])
        char *lxcpath = argv[1];
        bool mainloop_opened = false;
        bool monitord_created = false;
+       struct lxc_log log;
 
        if (argc != 3) {
                fprintf(stderr,
@@ -364,7 +366,13 @@ int main(int argc, char *argv[])
        if (ret < 0 || ret >= sizeof(logpath))
                exit(EXIT_FAILURE);
 
-       ret = lxc_log_init(NULL, logpath, "DEBUG", "lxc-monitord", 0, lxcpath);
+       log.name = NULL;
+       log.file = logpath;
+       log.priority = "DEBUG";
+       log.prefix = "lxc-monitord";
+       log.quiet = 0;
+       log.lxcpath = lxcpath;
+       ret = lxc_log_init(&log);
        if (ret)
                INFO("Failed to open log file %s, log will be lost.", lxcpath);
        lxc_log_options_no_override();
index 57301e658ab7541269e67ebc46ab14d499ca1e8c..3b45d75b78d4ddb4c5a16de5c3e366cdc3eb238a 100644 (file)
@@ -1017,6 +1017,22 @@ int list_active_containers(const char *lxcpath, char ***names, struct lxc_contai
  */
 int list_all_containers(const char *lxcpath, char ***names, struct lxc_container ***cret);
 
+struct lxc_log {
+       const char *name;
+       const char *lxcpath;
+       const char *file;
+       const char *priority;
+       const char *prefix;
+       bool quiet;
+};
+
+/*!
+ *\brief Initialize the log
+ *
+ *\param log lxc log configuration.
+ */
+int lxc_log_init(struct lxc_log *log);
+
 /*!
  * \brief Close log file.
  */
index d35ec88c10525aa1f43e1c6ecf3f8ea9d2d688d8..d619e1844551a1fa346fabbaa200396d87b4c02f 100644 (file)
@@ -371,6 +371,7 @@ int main(int argc, char *argv[])
 {
        int ret = -1, r;
        int wexit = 0;
+       struct lxc_log log;
        pid_t pid;
        lxc_attach_options_t attach_options = LXC_ATTACH_OPTIONS_DEFAULT;
        lxc_attach_command_t command = (lxc_attach_command_t){.program = NULL};
@@ -386,8 +387,13 @@ int main(int argc, char *argv[])
        if (!my_args.log_file)
                my_args.log_file = "none";
 
-       r = lxc_log_init(my_args.name, my_args.log_file, my_args.log_priority,
-                          my_args.progname, my_args.quiet, my_args.lxcpath[0]);
+       log.name = my_args.name;
+       log.file = my_args.log_file;
+       log.priority = my_args.log_priority;
+       log.prefix = my_args.progname;
+       log.quiet = my_args.quiet;
+       log.lxcpath = my_args.lxcpath[0];
+       r = lxc_log_init(&log);
        if (r)
                exit(EXIT_FAILURE);
        lxc_log_options_no_override();
index a24dd7cdd5abcb9fccf19b74d9b95003decf4855..68d10144bbe0989c13d436461e8a3d1c6f254b0b 100644 (file)
@@ -352,12 +352,19 @@ int main(int argc, char *argv[])
        struct lxc_container **containers = NULL;
        struct lxc_list **c_groups_lists = NULL;
        struct lxc_list *cmd_group;
+       struct lxc_log log;
 
        if (lxc_arguments_parse(&my_args, argc, argv))
                exit(EXIT_FAILURE);
 
-       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]))
+       log.name = my_args.name;
+       log.file = my_args.log_file;
+       log.priority = my_args.log_priority;
+       log.prefix = my_args.progname;
+       log.quiet = my_args.quiet;
+       log.lxcpath = my_args.lxcpath[0];
+
+       if (lxc_log_init(&log))
                exit(EXIT_FAILURE);
        lxc_log_options_no_override();
 
index 40276307385fc302d531034680f9d1611d1ef155..a7237a833e3833c117d40cc65df85f56f5bfa9c6 100644 (file)
@@ -67,6 +67,7 @@ int main(int argc, char *argv[])
 {
        char *state_object = NULL, *value = NULL;
        struct lxc_container *c;
+       struct lxc_log log;
 
        if (lxc_arguments_parse(&my_args, argc, argv))
                exit(EXIT_FAILURE);
@@ -74,8 +75,14 @@ int main(int argc, char *argv[])
        if (!my_args.log_file)
                my_args.log_file = "none";
 
-       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]))
+       log.name = my_args.name;
+       log.file = my_args.log_file;
+       log.priority = my_args.log_priority;
+       log.prefix = my_args.progname;
+       log.quiet = my_args.quiet;
+       log.lxcpath = my_args.lxcpath[0];
+
+       if (lxc_log_init(&log))
                exit(EXIT_FAILURE);
        lxc_log_options_no_override();
 
index c42cecdb3d82b0aab2573aaceeed3136fad222b0..0a18690095fd0e10ade94001dd563c95d45e8987 100644 (file)
@@ -234,6 +234,7 @@ static bool restore(struct lxc_container *c)
 int main(int argc, char *argv[])
 {
        struct lxc_container *c;
+       struct lxc_log log;
        bool ret;
 
        if (lxc_arguments_parse(&my_args, argc, argv))
@@ -242,8 +243,14 @@ int main(int argc, char *argv[])
        if (!my_args.log_file)
                my_args.log_file = "none";
 
-       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]))
+       log.name = my_args.name;
+       log.file = my_args.log_file;
+       log.priority = my_args.log_priority;
+       log.prefix = my_args.progname;
+       log.quiet = my_args.quiet;
+       log.lxcpath = my_args.lxcpath[0];
+
+       if (lxc_log_init(&log))
                exit(EXIT_FAILURE);
 
        lxc_log_options_no_override();
index 88a24bec3fda94f713341dfae00a0ec0c7a44636..eb57e489a4e993269bedcd92281267ea21ceb057 100644 (file)
@@ -98,6 +98,7 @@ int main(int argc, char *argv[])
 {
        int ret;
        struct lxc_container *c;
+       struct lxc_log log;
 
        ret = lxc_arguments_parse(&my_args, argc, argv);
        if (ret)
@@ -106,8 +107,14 @@ int main(int argc, char *argv[])
        if (!my_args.log_file)
                my_args.log_file = "none";
 
-       ret = lxc_log_init(my_args.name, my_args.log_file, my_args.log_priority,
-                          my_args.progname, my_args.quiet, my_args.lxcpath[0]);
+       log.name = my_args.name;
+       log.file = my_args.log_file;
+       log.priority = my_args.log_priority;
+       log.prefix = my_args.progname;
+       log.quiet = my_args.quiet;
+       log.lxcpath = my_args.lxcpath[0];
+
+       ret = lxc_log_init(&log);
        if (ret)
                return EXIT_FAILURE;
        lxc_log_options_no_override();
index 0627a6272bbefbabd418c46351ec9f2a0072d5ee..17d748d38a48f5d1c0f7821a0916c7c3ed07fe37 100644 (file)
@@ -169,6 +169,7 @@ static int parse_ovl_mnt(char *mntstring, enum mnttype type);
 int main(int argc, char *argv[])
 {
        struct lxc_container *c;
+       struct lxc_log log;
        int flags = 0;
        int ret = EXIT_FAILURE;
 
@@ -178,8 +179,14 @@ int main(int argc, char *argv[])
        if (!my_args.log_file)
                my_args.log_file = "none";
 
-       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]))
+       log.name = my_args.name;
+       log.file = my_args.log_file;
+       log.priority = my_args.log_priority;
+       log.prefix = my_args.progname;
+       log.quiet = my_args.quiet;
+       log.lxcpath = my_args.lxcpath[0];
+
+       if (lxc_log_init(&log))
                exit(ret);
        lxc_log_options_no_override();
 
index b8795c4462a4ad388c5ce6914d90b5b701df3db0..c8691a3defbc796dd4817c5975d5b375777405e6 100644 (file)
@@ -208,6 +208,7 @@ int main(int argc, char *argv[])
 {
        struct lxc_container *c;
        struct bdev_specs spec;
+       struct lxc_log log;
        int flags = 0;
 
        if (lxc_arguments_parse(&my_args, argc, argv))
@@ -216,8 +217,14 @@ int main(int argc, char *argv[])
        if (!my_args.log_file)
                my_args.log_file = "none";
 
-       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]))
+       log.name = my_args.name;
+       log.file = my_args.log_file;
+       log.priority = my_args.log_priority;
+       log.prefix = my_args.progname;
+       log.quiet = my_args.quiet;
+       log.lxcpath = my_args.lxcpath[0];
+
+       if (lxc_log_init(&log))
                exit(EXIT_FAILURE);
        lxc_log_options_no_override();
 
index 3f46415df8537135cc7735f3b0b7da00017fa756..7c1c17ebaa6da842616f720f1795cc8ef755bcb7 100644 (file)
@@ -67,6 +67,7 @@ static bool do_destroy_with_snapshots(struct lxc_container *c);
 int main(int argc, char *argv[])
 {
        struct lxc_container *c;
+       struct lxc_log log;
        bool bret;
 
        if (lxc_arguments_parse(&my_args, argc, argv))
@@ -75,8 +76,14 @@ int main(int argc, char *argv[])
        if (!my_args.log_file)
                my_args.log_file = "none";
 
-       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]))
+       log.name = my_args.name;
+       log.file = my_args.log_file;
+       log.priority = my_args.log_priority;
+       log.prefix = my_args.progname;
+       log.quiet = my_args.quiet;
+       log.lxcpath = my_args.lxcpath[0];
+
+       if (lxc_log_init(&log))
                exit(EXIT_FAILURE);
        lxc_log_options_no_override();
        if (my_args.quiet)
index 39c560cb9e51cce779e78fe17a7c35c8e013d5fe..6ce769a6ae36147a485beb4d4bc84b309d9e7fa3 100644 (file)
@@ -101,6 +101,7 @@ static bool is_interface(const char* dev_name, pid_t pid)
 int main(int argc, char *argv[])
 {
        struct lxc_container *c;
+       struct lxc_log log;
        char *cmd, *dev_name, *dst_name;
        bool ret = false;
 
@@ -115,8 +116,14 @@ int main(int argc, char *argv[])
        if (!my_args.log_file)
                my_args.log_file = "none";
 
-       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]))
+       log.name = my_args.name;
+       log.file = my_args.log_file;
+       log.priority = my_args.log_priority;
+       log.prefix = my_args.progname;
+       log.quiet = my_args.quiet;
+       log.lxcpath = my_args.lxcpath[0];
+
+       if (lxc_log_init(&log))
                goto err;
        lxc_log_options_no_override();
 
index f26105ad66c8bc84aa99aeabf44f1bc69606961c..5eeee033333afbc2e80d6d6b9a93a35d7acfd15d 100644 (file)
@@ -40,6 +40,7 @@
 #include "config.h"
 #include "start.h"
 #include "utils.h"
+#include "lxccontainer.h"
 
 lxc_log_define(lxc_execute_ui, lxc);
 
@@ -106,6 +107,7 @@ int main(int argc, char *argv[])
 {
        char *rcfile;
        struct lxc_conf *conf;
+       struct lxc_log log;
        int ret;
 
        lxc_list_init(&defines);
@@ -116,8 +118,14 @@ int main(int argc, char *argv[])
        if (lxc_arguments_parse(&my_args, argc, argv))
                exit(EXIT_FAILURE);
 
-       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]))
+       log.name = my_args.name;
+       log.file = my_args.log_file;
+       log.priority = my_args.log_priority;
+       log.prefix = my_args.progname;
+       log.quiet = my_args.quiet;
+       log.lxcpath = my_args.lxcpath[0];
+
+       if (lxc_log_init(&log))
                exit(EXIT_FAILURE);
        lxc_log_options_no_override();
 
index 33445c89e183da56359e1bbbcda786f851801a0f..3db1b6a4f525d1986824fdd4465af35259777171 100644 (file)
@@ -57,6 +57,7 @@ Options :\n\
 int main(int argc, char *argv[])
 {
        struct lxc_container *c;
+       struct lxc_log log;
 
        if (lxc_arguments_parse(&my_args, argc, argv))
                exit(EXIT_FAILURE);
@@ -64,8 +65,14 @@ int main(int argc, char *argv[])
        if (!my_args.log_file)
                my_args.log_file = "none";
 
-       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]))
+       log.name = my_args.name;
+       log.file = my_args.log_file;
+       log.priority = my_args.log_priority;
+       log.prefix = my_args.progname;
+       log.quiet = my_args.quiet;
+       log.lxcpath = my_args.lxcpath[0];
+
+       if (lxc_log_init(&log))
                exit(EXIT_FAILURE);
        lxc_log_options_no_override();
 
index c977f299c7ac423aa509cb4be582d410662e26fe..bb919b5e5ed4bd3d33bce1fb74dbd8adb70f0ead 100644 (file)
@@ -394,6 +394,7 @@ static int print_info(const char *name, const char *lxcpath)
 int main(int argc, char *argv[])
 {
        int ret = EXIT_FAILURE;
+       struct lxc_log log;
 
        if (lxc_arguments_parse(&my_args, argc, argv))
                exit(ret);
@@ -401,8 +402,14 @@ int main(int argc, char *argv[])
        if (!my_args.log_file)
                my_args.log_file = "none";
 
-       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]))
+       log.name = my_args.name;
+       log.file = my_args.log_file;
+       log.priority = my_args.log_priority;
+       log.prefix = my_args.progname;
+       log.quiet = my_args.quiet;
+       log.lxcpath = my_args.lxcpath[0];
+
+       if (lxc_log_init(&log))
                exit(ret);
        lxc_log_options_no_override();
 
index 1aaa96cd653eacc0970bfa982ca457da4e448eb6..456d3fb034d01c5846f72fc8ada2ac34a23c51b9 100644 (file)
@@ -37,6 +37,7 @@
 #include "caps.h"
 #include "error.h"
 #include "initutils.h"
+#include "lxccontainer.h"
 
 lxc_log_define(lxc_init, lxc);
 
@@ -83,6 +84,7 @@ int main(int argc, char *argv[])
        int i, have_status = 0, shutdown = 0;
        int opt;
        char *lxcpath = NULL, *name = NULL, *logpriority = NULL;
+       struct lxc_log log;
 
        while ((opt = getopt_long(argc, argv, "n:l:qP:", options, NULL)) != -1) {
                switch(opt) {
@@ -94,7 +96,7 @@ int main(int argc, char *argv[])
                        break;
                case 'q':
                        quiet = 1;
-                       break;
+                       break;
                case 'P':
                        lxcpath = optarg;
                        break;
@@ -104,8 +106,14 @@ int main(int argc, char *argv[])
                }
        }
 
-       err = lxc_log_init(name, name ? NULL : "none", logpriority,
-                          basename(argv[0]), quiet, lxcpath);
+       log.name = name;
+       log.file = name ? NULL : "none";
+       log.priority = logpriority;
+       log.prefix = basename(argv[0]);
+       log.quiet = quiet;
+       log.lxcpath = lxcpath;
+
+       err = lxc_log_init(&log);
        if (err < 0)
                exit(EXIT_FAILURE);
        lxc_log_options_no_override();
index 63053b110eb5ad5687af6314537c5cae9cea0eac..28d423909411b1c2e9b8966583cdc8ad368a3285 100644 (file)
@@ -203,6 +203,7 @@ Options :\n\
 int main(int argc, char *argv[])
 {
        int ret = EXIT_FAILURE;
+       struct lxc_log log;
        /*
         * The lxc parser requires that my_args.name is set. So let's satisfy
         * that condition by setting a dummy name which is never used.
@@ -218,8 +219,14 @@ int main(int argc, char *argv[])
         * We set the first argument that usually takes my_args.name to NULL so
         * that the log is only used when the user specifies a file.
         */
-       if (lxc_log_init(NULL, my_args.log_file, my_args.log_priority,
-                        my_args.progname, my_args.quiet, my_args.lxcpath[0]))
+       log.name = NULL;
+       log.file = my_args.log_file;
+       log.priority = my_args.log_priority;
+       log.prefix = my_args.progname;
+       log.quiet = my_args.quiet;
+       log.lxcpath = my_args.lxcpath[0];
+
+       if (lxc_log_init(&log))
                exit(EXIT_FAILURE);
        lxc_log_options_no_override();
 
index d9da9b8bcd586414560531fc48a147da3c6a3cc8..8050413488b8a3070a3a055ed2295754c6a066fa 100644 (file)
@@ -35,6 +35,7 @@
 #include "log.h"
 #include "monitor.h"
 #include "arguments.h"
+#include "lxccontainer.h"
 
 lxc_log_define(lxc_monitor_ui, lxc);
 
@@ -91,6 +92,7 @@ int main(int argc, char *argv[])
        struct pollfd *fds;
        nfds_t nfds;
        int len, rc_main, rc_snp, i;
+       struct lxc_log log;
 
        rc_main = EXIT_FAILURE;
 
@@ -100,8 +102,14 @@ int main(int argc, char *argv[])
        if (!my_args.log_file)
                my_args.log_file = "none";
 
-       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]))
+       log.name = my_args.name;
+       log.file = my_args.log_file;
+       log.priority = my_args.log_priority;
+       log.prefix = my_args.progname;
+       log.quiet = my_args.quiet;
+       log.lxcpath = my_args.lxcpath[0];
+
+       if (lxc_log_init(&log))
                exit(rc_main);
        lxc_log_options_no_override();
 
index 6948d19889e77a4fed68f435263c22a4056f6a48..ee0bff858ac1325b0e25712b3e87dc8070b68f40 100644 (file)
@@ -81,6 +81,7 @@ static void print_file(char *path);
 int main(int argc, char *argv[])
 {
        struct lxc_container *c;
+       struct lxc_log log;
        int ret;
 
        if (lxc_arguments_parse(&my_args, argc, argv))
@@ -89,8 +90,14 @@ int main(int argc, char *argv[])
        if (!my_args.log_file)
                my_args.log_file = "none";
 
-       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]))
+       log.name = my_args.name;
+       log.file = my_args.log_file;
+       log.priority = my_args.log_priority;
+       log.prefix = my_args.progname;
+       log.quiet = my_args.quiet;
+       log.lxcpath = my_args.lxcpath[0];
+
+       if (lxc_log_init(&log))
                exit(EXIT_FAILURE);
        lxc_log_options_no_override();
 
index 3c17ea0f981a859dbacfab17ab8111704c9d4800..469732db152dbb6832598565c7e94a2c06641329 100644 (file)
@@ -205,6 +205,7 @@ int main(int argc, char *argv[])
 {
        int err = EXIT_FAILURE;
        struct lxc_conf *conf;
+       struct lxc_log log;
        char *const *args;
        char *rcfile = NULL;
        char *const default_args[] = {
@@ -226,8 +227,14 @@ int main(int argc, char *argv[])
        else
                args = my_args.argv;
 
-       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]))
+       log.name = my_args.name;
+       log.file = my_args.log_file;
+       log.priority = my_args.log_priority;
+       log.prefix = my_args.progname;
+       log.quiet = my_args.quiet;
+       log.lxcpath = my_args.lxcpath[0];
+
+       if (lxc_log_init(&log))
                exit(err);
        lxc_log_options_no_override();
 
index e2d64fb5cca0fb2b1ad7157008be9333aa8e29bd..4dfb6541473a02362cfced4da2ef9a9fb02b1a06 100644 (file)
@@ -155,14 +155,21 @@ out:
 int main(int argc, char *argv[])
 {
        struct lxc_container *c;
+       struct lxc_log log;
        bool s;
        int ret = EXIT_FAILURE;
 
        if (lxc_arguments_parse(&my_args, argc, argv))
                exit(ret);
 
-       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]))
+       log.name = my_args.name;
+       log.file = my_args.log_file;
+       log.priority = my_args.log_priority;
+       log.prefix = my_args.progname;
+       log.quiet = my_args.quiet;
+       log.lxcpath = my_args.lxcpath[0];
+
+       if (lxc_log_init(&log))
                exit(ret);
        lxc_log_options_no_override();
 
index 539654dfc7f27fb05f08d486973e1cc2de573e8b..8461eb19eaefdfa3d3ef85e2fbb2afa67a4b4b80 100644 (file)
@@ -55,6 +55,7 @@ Options :\n\
 int main(int argc, char *argv[])
 {
        struct lxc_container *c;
+       struct lxc_log log;
 
        if (lxc_arguments_parse(&my_args, argc, argv))
                exit(EXIT_FAILURE);
@@ -62,8 +63,15 @@ int main(int argc, char *argv[])
        if (!my_args.log_file)
                my_args.log_file = "none";
 
-       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]))
+       log.name = my_args.name;
+       log.file = my_args.log_file;
+       log.priority = my_args.log_priority;
+       log.prefix = my_args.progname;
+       log.quiet = my_args.quiet;
+       log.lxcpath = my_args.lxcpath[0];
+
+
+       if (lxc_log_init(&log))
                exit(EXIT_FAILURE);
        lxc_log_options_no_override();
 
index de95696aaab27f96ce9b816bcc1611c9656d4852..7ab22b5d8b08b2daeb6717081ee215165bd89c4e 100644 (file)
@@ -83,6 +83,7 @@ Options :\n\
 int main(int argc, char *argv[])
 {
        struct lxc_container *c;
+       struct lxc_log log;
 
        if (lxc_arguments_parse(&my_args, argc, argv))
                exit(EXIT_FAILURE);
@@ -90,8 +91,14 @@ int main(int argc, char *argv[])
        if (!my_args.log_file)
                my_args.log_file = "none";
 
-       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]))
+       log.name = my_args.name;
+       log.file = my_args.log_file;
+       log.priority = my_args.log_priority;
+       log.prefix = my_args.progname;
+       log.quiet = my_args.quiet;
+       log.lxcpath = my_args.lxcpath[0];
+
+       if (lxc_log_init(&log))
                exit(EXIT_FAILURE);
        lxc_log_options_no_override();