capture_warnings#

caf.toolkit.log_helpers.capture_warnings(stream_handler=True, stream_handler_args=None, file_handler_args=None)[source]#

Capture warnings using logging.

Runs logging.captureWarnings(True) to capture warnings then sets up custom stream and file handlers if required.

Parameters:
  • stream_handler (bool, default True) – Add stream handler to warnings logger.

  • stream_handler_args (Dict[str, Any], optional) – Custom arguments for the stream handler, passed to get_console_handler.

  • file_handler_args (Dict[str, Any], optional) – Custom arguments for the file handler, passed to get_file_handler.

Return type:

None