Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppress icclim logger output #308

Open
ritviksahajpal opened this issue Mar 9, 2024 · 1 comment
Open

Suppress icclim logger output #308

ritviksahajpal opened this issue Mar 9, 2024 · 1 comment

Comments

@ritviksahajpal
Copy link

  • 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
Copy link
Member

bzah commented Mar 11, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants