armi.runLog module¶
This module handles logging of console output (e.g. warnings, information, errors) during an armi run.
The default way of using the ARMI runLog is:
import armi.runLog as runLog
runLog.setVerbosity('debug')
runLog.info('information here')
runLog.error('extra error info here')
raise SomeException # runLog.error() implies that the code will crash!
Note
We plan to reimplement this with the standard Python logging module. It was customized to add a few features in a HPC/MPI environment but we now think we can use the standard system.
-
armi.runLog.getLogVerbosityLevels()[source]¶ Return a list of the available log levels (e.g., debug, extra, etc.).
-
armi.runLog.getLogVerbosityRank(level)[source]¶ Return integer verbosity rank given the string verbosity name.
-
class
armi.runLog.Log(verbosity=50)[source]¶ Bases:
objectAbstract class that ARMI code calls to be rendered to some kind of log.
Build a log object
- Parameters
verbosity (int) – if a msg verbosity is > this, it will be emitted. The default of 50 means only error messages will be emitted. This usually gets adjusted by user settings quickly after instantiation.
-
standardLogMsg(msgType, msg, single=False, label=None)[source]¶ Add formatting to a message and handle its singleness, if applicable.
This is a wrapper around _emit that does most of the work and is used by all message passers (e.g. info, warning, etc.).
The MPI_RANK printout was removed because it’s obvious in the stdout now.
-
setVerbosity(levelInput)[source]¶ Sets the minimum output verbosity for the logger.
Any message with a higher verbosity than this will be emitted.
- Parameters
levelInput (int or str) – The level to set the log output verbosity to. Valid numbers are 0-50 and valid strings are keys of _logLevels
Examples
>>> setVerbosity('debug') -> sets to 0 >>> setVerbosity(0) -> sets to 0
-
class
armi.runLog.PrintLog(verbosity=50)[source]¶ Bases:
armi.runLog.LogLog that emits to stdout/stderr or file-based streams (for MPI workers) with print.
Build a log object
- Parameters
verbosity (int) – if a msg verbosity is > this, it will be emitted. The default of 50 means only error messages will be emitted. This usually gets adjusted by user settings quickly after instantiation.
-
class
armi.runLog.PrintLogCombined(verbosity=50)[source]¶ Bases:
armi.runLog.PrintLogPrint log that doesn’t break up into files
Build a log object
- Parameters
verbosity (int) – if a msg verbosity is > this, it will be emitted. The default of 50 means only error messages will be emitted. This usually gets adjusted by user settings quickly after instantiation.