Commit fe8c37ef by 2xsec

tools: lxc-freeze: add default log priority & cleanups

Signed-off-by: 's avatar2xsec <dh48.jeong@samsung.com>
parent c2a23ef6
...@@ -41,8 +41,8 @@ static const struct option my_longopts[] = { ...@@ -41,8 +41,8 @@ static const struct option my_longopts[] = {
}; };
static struct lxc_arguments my_args = { static struct lxc_arguments my_args = {
.progname = "lxc-freeze", .progname = "lxc-freeze",
.help = "\ .help = "\
--name=NAME\n\ --name=NAME\n\
\n\ \n\
lxc-freeze freezes a container with the identifier NAME\n\ lxc-freeze freezes a container with the identifier NAME\n\
...@@ -50,9 +50,11 @@ lxc-freeze freezes a container with the identifier NAME\n\ ...@@ -50,9 +50,11 @@ lxc-freeze freezes a container with the identifier NAME\n\
Options :\n\ Options :\n\
-n, --name=NAME NAME of the container\n\ -n, --name=NAME NAME of the container\n\
--rcfile=FILE Load configuration file FILE\n", --rcfile=FILE Load configuration file FILE\n",
.options = my_longopts, .options = my_longopts,
.parser = NULL, .parser = NULL,
.checker = NULL, .checker = NULL,
.log_priority = "ERROR",
.log_file = "none",
}; };
int main(int argc, char *argv[]) int main(int argc, char *argv[])
...@@ -63,18 +65,15 @@ int main(int argc, char *argv[]) ...@@ -63,18 +65,15 @@ int main(int argc, char *argv[])
if (lxc_arguments_parse(&my_args, argc, argv)) if (lxc_arguments_parse(&my_args, argc, argv))
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
/* Only create log if explicitly instructed */ log.name = my_args.name;
if (my_args.log_file || my_args.log_priority) { log.file = my_args.log_file;
log.name = my_args.name; log.level = my_args.log_priority;
log.file = my_args.log_file; log.prefix = my_args.progname;
log.level = my_args.log_priority; log.quiet = my_args.quiet;
log.prefix = my_args.progname; log.lxcpath = my_args.lxcpath[0];
log.quiet = my_args.quiet;
log.lxcpath = my_args.lxcpath[0];
if (lxc_log_init(&log)) if (lxc_log_init(&log))
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
}
c = lxc_container_new(my_args.name, my_args.lxcpath[0]); c = lxc_container_new(my_args.name, my_args.lxcpath[0]);
if (!c) { if (!c) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment