configure_logging

configure_logging#

rapidtools.config.configure_logging(level: int | str = 20, stream: Any = None, fmt: str = '%(asctime)s- %(levelname)s: %(message)s', datefmt: str = '%Y-%m-%d %H:%M:%S') → Logger[source]#

Attach a console handler to the rapidtools logger.

Importing the library never touches logging configuration (it only adds a logging.NullHandler); scripts and notebooks call this once to see progress messages. Calling it again replaces the previous handler. The rapidtools logger stops propagating to the root logger so messages are printed once even when the application configured root logging too; skip this function if you would rather route rapidtools through your own handlers.

Parameters:
  • level – Logging level for the rapidtools logger.

  • stream – Output stream; defaults to sys.stdout.

  • fmt – Log record format.

  • datefmt – Timestamp format.

Returns:

logging.Logger – The configured rapidtools logger.

Example

>>> import rapidtools
>>> rapidtools.configure_logging('INFO')
<Logger rapidtools (INFO)>