pyprep.set_log_level#

pyprep.set_log_level(level, return_old_level=False)[source]#

Change the level of the pyprep logger, leaving its handlers alone.

Use this rather than pyprep.setup_logging() to turn the package up or down: pyprep.setup_logging() also decides where the records go, so calling it again just to change the level would reset the stream, the format, and the propagation that an application had chosen.

Parameters:
levelint | str

Level for the pyprep logger, either a name (e.g. "debug", "WARNING") or a stdlib constant such as logging.DEBUG. Names are case-insensitive, as in mne.set_log_level().

return_old_levelbool

Whether to return the level the logger had before this call, so that a caller can put it back afterwards. Defaults to False.

Returns:
old_levelint | None

The previous level of the pyprep logger if return_old_level is True, and None otherwise.

Notes

This cannot make records appear on its own. Until pyprep.setup_logging() has run, or the application has configured a logger that this one propagates to, there is no handler to write them.