supy.enable_file_logging

Tip

  1. Need help? Please let us know in the SUEWS Community.

  2. Please report issues with the manual on GitHub Issues (or use Report Issue for This Page for page-specific feedback).

  3. Please cite SUEWS with proper information from our Zenodo page.

6.2.3.1. supy.enable_file_logging#

supy.enable_file_logging(path=None)[source]#

Write SuPy log messages to a file (opt-in).

Parameters:

path (str or pathlib.Path, optional) – Target log file (a leading ~ is expanded to the home directory), or an existing directory / a path with a trailing separator, in which a SuPy.log file is written. Defaults to SuPy.log in the current working directory. For a directory that may not exist yet, prefer the SUPY_LOG_DIR environment variable.

Returns:

The resolved log-file path. The file itself is not created until the first log record is emitted (delay=True).

Return type:

pathlib.Path

Notes

Calling this again after file logging is already enabled is a no-op; the existing handler’s path is returned. Call disable_file_logging() first to switch to a different file.