Commit 62ebeb04 by 2xsec

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

Signed-off-by: 's avatar2xsec <dh48.jeong@samsung.com>
parent 81b46065
......@@ -36,15 +36,7 @@
lxc_log_define(lxc_cgroup, lxc);
static int my_checker(const struct lxc_arguments* args)
{
if (!args->argc) {
ERROR("Missing state object");
return -1;
}
return 0;
}
static int my_checker(const struct lxc_arguments *args);
static const struct option my_longopts[] = {
LXC_COMMON_OPTIONS
......@@ -64,8 +56,20 @@ Options :\n\
.options = my_longopts,
.parser = NULL,
.checker = my_checker,
.log_priority = "ERROR",
.log_file = "none",
};
static int my_checker(const struct lxc_arguments *args)
{
if (!args->argc) {
ERROR("Missing state object");
return -1;
}
return 0;
}
int main(int argc, char *argv[])
{
char *state_object = NULL, *value = NULL;
......@@ -75,8 +79,6 @@ int main(int argc, char *argv[])
if (lxc_arguments_parse(&my_args, argc, argv))
exit(EXIT_FAILURE);
/* Only create log if explicitly instructed */
if (my_args.log_file || my_args.log_priority) {
log.name = my_args.name;
log.file = my_args.log_file;
log.level = my_args.log_priority;
......@@ -86,7 +88,6 @@ int main(int argc, char *argv[])
if (lxc_log_init(&log))
exit(EXIT_FAILURE);
}
state_object = my_args.argv[0];
......@@ -143,6 +144,7 @@ int main(int argc, char *argv[])
lxc_container_put(c);
exit(EXIT_FAILURE);
}
INFO("%*s", ret, buffer);
}
......
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