cerfacs-globc/icclim

Suppress icclim logger output

Opened this issue · 1 comments

  • icclim version: 6.4.0
  • Python version: 3.11.6

Description

I would like to suppress all logger output from icclim, or maybe have the option to choose the level at which icclim outputs

Minimal reproducible example

class NullHandler(logging.Handler):
    def emit(self, record):
        pass

logger = logging.getLogger('icclim')
logger.addHandler(NullHandler())
logger.propagate = False

Output received

By adding the code above in the code, I was expecting to suppress all logging output from icclim, but it did not work. Can you help me figure out what code to use to suppress/control icclim logger output

bzah commented

When calling icclim.index, you can silence logs by setting logs_verbosity="SILENT". Only errors are then reported.
For now we use the root logger to emit our logs, but it would probably make sense to have a named logger that users could easily suppress like in your attempt.