nwm_eval.logging_utils.setup_logging#

nwm_eval.logging_utils.setup_logging(level=20, log_file=None, file_level=None, filter_stderr=False)[source]#

Configure logging with noise suppression for distributed workloads.

Parameters:
  • level (int | str) – Logging level for console output (default: logging.INFO).

  • log_file (str | Path, optional) – Optional path to a log file for file output.

  • file_level (int | str, optional) – Optional logging level for file output (defaults to console level if not provided).

  • filter_stderr (bool, optional) – If True, redirect sys.stderr to a filter that suppresses noisy output (use with caution).

Returns:

None. Configures logging globally.

Note: Enabling stderr filtering can suppress important error messages from libraries that write directly to stderr. Use with caution and consider the implications for debugging and monitoring in production environments.