armi.runLog module¶
This module handles logging of console during a simulation.
The default way of calling and the global armi logger is to just import it:
from armi import runLog
You may want a logger specific to a single module, say to provide debug logging for only one module. That functionality is provided by a global override of logging imports:
import logging
runLog = logging.getLogger(__name__)
In either case, you can then log things the same way:
runLog.info('information here')
runLog.error('extra error info here')
raise SomeException # runLog.error() implies that the code will crash!
Or change the log level the same way:
runLog.setVerbosity('debug')
- armi.runLog.close(mpiRank=None)[source]¶
End use of the log. Concatenate if needed and restore defaults.
- armi.runLog.concatenateLogs(logDir=None)[source]¶
Concatenate the armi run logs and delete them.
Should only ever be called by parent.
- class armi.runLog.DeduplicationFilter(*args, **kwargs)[source]¶
Bases:
logging.Filter
Important logging filter.
allow users to turn off duplicate warnings
handles special indentation rules for our logs
- class armi.runLog.RunLogger(*args, **kwargs)[source]¶
Bases:
logging.Logger
Custom Logger to support our specific desires.
Giving users the option to de-duplicate warnings
Piping stderr to a log file
- FMT = '%(levelname)s%(message)s'¶
- log(msgType, msg, single=False, label=None, **kwargs)[source]¶
This is a wrapper around logger.log() that does most of the work.
This is used by all message passers (e.g. info, warning, etc.). In this situation, we do the mangling needed to get the log level to the correct number. And we do some custom string manipulation so we can handle de-duplicating warnings.
- allowStopDuplicates()[source]¶
Helper method to allow us to safely add the deduplication filter at any time.
- class armi.runLog.NullLogger(name, isStderr=False)[source]¶
Bases:
armi.runLog.RunLogger
This is really just a placeholder for logging before or after the span of a normal armi run.
It will forward all logging to stdout/stderr, as you’d normally expect. But it will preserve the formatting and duplication tools of the armi library.