diff options
author | Ralph Boehme <slow@samba.org> | 2018-12-12 13:11:26 +0100 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2018-12-20 03:19:27 +0100 |
commit | 249bdd9378306c146dca0eec6711e2c6b8eae29a (patch) | |
tree | 0b725fbf897d3548e1dee8d3efb9b0dcff4104cb | |
parent | abfb3c6bbf5d3d27ca61cd973ffb15c3d8e2be4f (diff) | |
download | samba-249bdd9378306c146dca0eec6711e2c6b8eae29a.tar.gz |
debug: add support for per debug-class logfiles
This adds support for per debug-class logfiles to the function parsing
the "log level" option.
The enhanced syntax is:
log level = CLASS:LEVEL[@PATH] [CLASS:LEVEL[@PATH] ... ]
Eg
log level = full_audit:1@/var/log/audit.logfile
While the option is already parsed and stored in in the dbgc_config[]
array, the feature is still effectively disabled, as
reopen_logs_internal() still doesn't open the per debug-class logfiles.
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
-rw-r--r-- | lib/util/debug.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/util/debug.c b/lib/util/debug.c index 780ce9a26c2..c315222a9bb 100644 --- a/lib/util/debug.c +++ b/lib/util/debug.c @@ -810,6 +810,7 @@ static void debug_dump_status(int level) static bool debug_parse_param(char *param) { char *class_name; + char *class_file = NULL; char *class_level; char *saveptr = NULL; int ndx; @@ -819,11 +820,13 @@ static bool debug_parse_param(char *param) return false; } - class_level = strtok_r(NULL, "\0", &saveptr); + class_level = strtok_r(NULL, "@\0", &saveptr); if (class_level == NULL) { return false; } + class_file = strtok_r(NULL, "\0", &saveptr); + ndx = debug_lookup_classname(class_name); if (ndx == -1) { return false; @@ -831,6 +834,16 @@ static bool debug_parse_param(char *param) dbgc_config[ndx].loglevel = atoi(class_level); + if (class_file == NULL) { + return true; + } + + TALLOC_FREE(dbgc_config[ndx].logfile); + + dbgc_config[ndx].logfile = talloc_strdup(NULL, class_file); + if (dbgc_config[ndx].logfile == NULL) { + return false; + } return true; } |