meeg_utils.setup_logging#

meeg_utils.setup_logging(level='INFO', log_file=None, file_level='DEBUG', *, enqueue=False)[source]#

Show meeg-utils log messages on the console and/or in a file.

Calling it again replaces the handlers added by the previous call. Handlers you added yourself are left alone; loguru’s built-in default stderr handler is removed so that messages are not printed twice.

Parameters:
  • level (str | None) – Minimum level shown on the console (stderr), e.g. "DEBUG", "INFO" or "WARNING". None disables console output.

  • log_file (str | Path | None) – File to write log messages to; parent directories are created. None (default) disables file logging.

  • file_level (str) – Minimum level written to log_file.

  • enqueue (bool) – Pass messages through a multiprocessing-safe queue. Use it when several processes write to the same file.

Examples

>>> import meeg_utils as meu
>>> meu.setup_logging("INFO", log_file="logs/preproc.log")