meeg_utils.log_to_file#

meeg_utils.log_to_file(log_file, level='DEBUG')[source]#

Write meeg-utils log messages to a file for the duration of a with block.

Afterwards the file handler is removed and, unless setup_logging() is active, meeg-utils is silenced again.

Parameters:
  • log_file (str | Path) – File to write to; parent directories are created.

  • level (str) – Minimum level written to the file.

Yields:

Path – The log file.