anuga.set_logfile

anuga.set_logfile(path, console_level=20, file_level=10, verbose_to_screen=False)[source]

Enable logging to path, tee-ing all print() output as well.

After this call:

  • sys.stdout is replaced with a TeeStream so every print() goes to both the terminal and path.

  • log.info() writes to both terminal and file.

  • log.verbose() / log.debug() write to the file only (unless verbose_to_screen=True).

  • The previous log file (if any) is closed.

Parameters:
  • path (str) – File path for the log file.

  • console_level (int) – Logging level for console output (default INFO). log.verbose() and log.debug() are below this threshold and go to the file only.

  • file_level (int) – Logging level for file output (default DEBUG — everything).

  • verbose_to_screen (bool) – If True, lower the console threshold to DEBUG so that log.verbose() output also appears on the terminal. Useful when debugging without needing a clean screen.