Archived
1
0
Fork 0

config: move log settings to its own section.

This commit is contained in:
Henrik Hautakoski 2011-02-06 19:26:12 +01:00
parent dfaa1be71f
commit ca73aa43ae
3 changed files with 15 additions and 14 deletions

View file

@ -1,7 +1,8 @@
[general]
uselog = 0 [log]
loglevel = INFO, WARNING, CRITCAL use = 0
logdir = logs level = INFO, WARNING, CRITCAL
directory = logs
[mysql] [mysql]
host = localhost host = localhost

View file

@ -17,20 +17,20 @@ String ;;
Options Options
~~~~~~ ~~~~~~
General Log
^^^^^^ ^^^^^^
Options available in the general section Options available in the log section
uselog (Boolean);; use (Boolean);;
Turn logging on/off (values are: Y, N, T, F, 1, 0) Turn logging on/off (values are: Y, N, T, F, 1, 0)
loglevel (String List);; level (String List);;
Set the logging level Set the logging level
Options available are: DEBUG, INFO, WARNING, CRITCAL, ALL Options available are: DEBUG, INFO, WARNING, CRITCAL, ALL
+ +
NOTE: A comma separated list can be used to specify more than one level. NOTE: A comma separated list can be used to specify more than one level.
+ +
logdir (String);; directory (String);;
Specify a logging directory Specify a logging directory

View file

@ -140,9 +140,9 @@ int main(int argc, char **argv) {
#ifdef __DEBUG__ #ifdef __DEBUG__
init_log(LOG_ALL, NULL); init_log(LOG_ALL, NULL);
#else #else
if (iniparser_getboolean(config, "general:uselog", 0)) { if (iniparser_getboolean(config, "log:use", 0)) {
char *strlevel = iniparser_getstring(config, "general:loglevel", NULL); char *strlevel = iniparser_getstring(config, "log:level", NULL);
char *path = iniparser_getstring(config, "general:logdir", NULL); char *path = iniparser_getstring(config, "log:directory", NULL);
unsigned level = 0; unsigned level = 0;
if (strlevel) { if (strlevel) {
@ -157,13 +157,13 @@ int main(int argc, char **argv) {
strbuf_trim(*ptr); strbuf_trim(*ptr);
l = logstrtolvl((*ptr)->buf); l = logstrtolvl((*ptr)->buf);
if (l == 0) if (l == 0)
die("config (general:loglevel): unknown log level: %s\n", (*ptr)->buf); die("config (log:level): unknown level: %s\n", (*ptr)->buf);
level += l; level += l;
} }
strbuf_free_list(list); strbuf_free_list(list);
strbuf_free(&sb); strbuf_free(&sb);
} else { } else {
die("config (general:loglevel): no levels defined\n"); die("config (log:level): no levels defined\n");
} }
init_log(level, path); init_log(level, path);