Loglevel not working as intended
Brought to you by:
jmaggard
Setting the logging level does not work as intended. No matter what log level you set in the config file, you still get all the logging events. The problem is in log.c where a && should be a ||. See diff against 1.1.1
* fix the loglevel logic --- minidlna-1.1.1-orig/log.c 2013-11-02 09:06:41.000000000 +0800 +++ minidlna-1.1.1/log.c 2014-01-20 22:56:24.000000000 +0800 @@ -133,7 +133,7 @@ { va_list ap; - if (level && level>log_level[facility] && level>E_FATAL) + if (level && level>log_level[facility] || level>E_FATAL) return; if (!log_fp)
My apologies for the patch, that was totally wrong. Here is a proper patch:
https://github.com/Darkvater/minidlna/compare/master...%23111-log_level.diff
I've written tests for it as well, don't really know where to put them. It allows a lot more flexibility:
'log_level=debug' => set the level for all categories in one go
'log_level=ssdp=debug' => set level for single category leaving everything else at default
'log_level=debug,ssdp=error' => set default, override for single category
and all the original options
Looks good, thanks! Added to git master.