Page MenuHomeSoftware Heritage

logger: allow to specify/override the loglevel for a specific module
Closed, MigratedEdits Locked

Description

We currently support passing "--log-level" to the swh CLI (or equivalent), which results in setting the log level of the root logger.
In some cases we would like to be able to have a different/higher log level for specific modules. This is currently the case, for instance, for swh-fuse, where we would like to log at debug level swh-fuse-specific stuff, without triggering debug loglevel for the entire stack.
To this end the proposal (by @douardda) is to support:

  • passing --log-level multiple times on the command line
  • allowing it to receive as arg non only global log level (e.g., "DEBUG"),
  • but also a qualified log-level (e.g., "swh.fuse:DEBUG")

the latter will register an additional logger, at the given level, and only for the specified module