Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
},
special={
'case_1': {
Verbosity.NORMAL: logging.Formatter(...)
...
},
...
}
}
"""
# Mapping of logging formatters for "special". Currently, only "from_subprocess" is defined. It's good to hide such
# implementation details as much as possible though they are still tweakable from the outer code
special_formatters = {
'from_subprocess': { # TODO: maybe remade as enum, too? To have an IDE hints and more safety in general
level: as_is_formatter for level in Verbosity
}
}
def __init__(self, *args, general: Mapping[Verbosity, logging.Formatter] = None,
special: Mapping[str, Mapping[Verbosity, logging.Formatter]] = None,
verbosity: Verbosity = Verbosity.NORMAL, **kwargs):
super().__init__(*args, **kwargs) # will be '%(message)s' if no arguments were given
self.verbosity = verbosity
self._warn_was_shown = False
if general is not None:
self.general = general
else:
warnings.warn("'general' argument for DispatchingFormatter was not provided. It contains formatters for "