Logging
- class pySC.utils.logging_tools.DebugMode(active=True, log_file=None)[source]
Context Manager for the debug mode.
- Parameters:
active (bool) -- Defines if this manager is doing anything. Defaults to
True
.log_file (str) -- File to log into.
- class pySC.utils.logging_tools.MaxFilter(level)[source]
To get messages only up to a certain level.
- pySC.utils.logging_tools.file_handler(logfile, level=10, fmt='%(levelname)7s | %(message)s | %(name)s')[source]
Convenience function so the caller does not have to import logging.
- pySC.utils.logging_tools.get_logger(name, level_root=10, level_console=None, fmt='%(levelname)7s | %(message)s | %(name)s', color=None)[source]
Sets up logger if name is __main__. Returns logger based on module name.
- Parameters:
name -- only used to check if __name__ is __main__.
level_root -- main logging level, defaults to
DEBUG
.level_console -- console logging level, defaults to
INFO
.fmt -- Format of the logging. For default see
BASIC_FORMAT
.color -- If None colors are used if tty is detected. False will never use colors and True will always enforce them.
- Returns:
Logger instance.