ubermagutil.setup_logging#

ubermagutil.setup_logging(level=30, package_levels=None)#

Set up basic logging for Ubermag with per-package control.

This function creates a basic logger (printing to stdout) and sets the log level for all packages in Ubermag to level. Additional, more fine-grain control is possible by passing a dictionary to package_levels. Keys must be ubermag subpackages, values log levels.

Parameters:
  • level (str, int, logging.LEVEL) – Log level used for all packages in Ubermag.

  • package_levels (dict, optional) – Dictionary with Ubermag subpackage names as keys and log-levels as values. It allows fine-grain control over logging for individual packages.

Example

  1. Setting up a basic logger with default log-level logging.WARNING

>>> import ubermagutil
>>> ubermagutil.setup_logging()
  1. Setting up a basic logger with a higher log-level for oommfc

>>> import ubermagutil
>>> ubermagutil.setup_logging(package_levels={'oommfc': logging.DEBUG})