Commit b12e1cb5 by S.Çağlar Onur Committed by Serge Hallyn

allow setting/getting lxc.loglevel and lxc.logfile via set_config_item/get_config_item API calls

parent 497a2995
...@@ -301,13 +301,13 @@ extern int lxc_log_init(const char *name, const char *file, ...@@ -301,13 +301,13 @@ extern int lxc_log_init(const char *name, const char *file,
} }
if (priority) { if (priority) {
lxc_loglevel_specified = 1;
lxc_priority = lxc_log_priority_to_int(priority);
if (lxc_priority == LXC_LOG_PRIORITY_NOTSET) { if (lxc_priority == LXC_LOG_PRIORITY_NOTSET) {
ERROR("invalid log priority %s", priority); ERROR("invalid log priority %s", priority);
return -1; return -1;
} }
lxc_loglevel_specified = 1;
lxc_priority = lxc_log_priority_to_int(priority);
} }
lxc_log_category_lxc.priority = lxc_priority; lxc_log_category_lxc.priority = lxc_priority;
...@@ -320,9 +320,9 @@ extern int lxc_log_init(const char *name, const char *file, ...@@ -320,9 +320,9 @@ extern int lxc_log_init(const char *name, const char *file,
lxc_log_set_prefix(prefix); lxc_log_set_prefix(prefix);
if (file) { if (file) {
lxc_logfile_specified = 1;
if (strcmp(file, "none") == 0) if (strcmp(file, "none") == 0)
return 0; return 0;
lxc_logfile_specified = 1;
ret = __lxc_log_set_file(file, 1); ret = __lxc_log_set_file(file, 1);
} else { } else {
ret = -1; ret = -1;
...@@ -368,6 +368,7 @@ extern int lxc_log_set_level(int level) ...@@ -368,6 +368,7 @@ extern int lxc_log_set_level(int level)
ERROR("invalid log priority %d", level); ERROR("invalid log priority %d", level);
return -1; return -1;
} }
lxc_loglevel_specified = 1;
lxc_log_category_lxc.priority = level; lxc_log_category_lxc.priority = level;
return 0; return 0;
} }
...@@ -396,6 +397,7 @@ extern int lxc_log_set_file(const char *fname) ...@@ -396,6 +397,7 @@ extern int lxc_log_set_file(const char *fname)
{ {
if (lxc_logfile_specified) if (lxc_logfile_specified)
return 0; return 0;
lxc_logfile_specified = 1;
return __lxc_log_set_file(fname, 0); return __lxc_log_set_file(fname, 0);
} }
......
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