Command-line log-level no longer accepts categories (dev)
jagerman opened this issue · 3 comments
Current dev introduces a few regressions in log-level handling:
-
The
--log-level
(orlog-level=...
in the config file) can no longer be set to a categorized string, but only to a single global level. This is really useful when debugging one particular subsystem to be able to throw it into debug logging while not getting debug logs from other bits.It looks like we do have log level parsing in logging/oxen_logger.cpp, but it seems to only be used via RPC, but isn't called by daemon/main.cpp, so this is probably just a matter of wiring it up.
-
Never mind, I'm wrong about this:
The numeric values given tolog-level
don't work the same as they used to: they used to map to a categorized list of levels so that level "2" would show info from some categories, warning from some.
One thing to keep in mind that might be an edge case in the current implementation: the meaning of --log-level=*:info
is different from --log-level=info
: the latter uses the pre-selected list of category levels (now in oxen_logger.cpp), but the former means "set everything to info level".
Another issue: in process_categories_string
if the given level is unknown (e.g. "cat:FOO") then nothing happens, but that should probably raise an exception rather than silently ignoring it.
Also: if it hasn't merged yet by the time you start working on this, there's a related commit (with title "Log levels: ...") that ought to be cherry-picked that makes the levels case-insensitive and adds some abbreviations to the levels list.