set_loglevel

Configure logging levels (and formatting).

rt1_model uses the standard library logging framework under the root logger ‘rt1_model’. This is a helper function to:

  • set rt1_model’s root logger level

  • set the root logger handler’s level, creating the handler if it does not exist yet

  • set the root logger handler’s formatter

Typically, one should call set_loglevel("info") or set_loglevel("debug") to get additional debugging information.

Users or applications that are installing their own logging handlers may want to directly manipulate logging.getLogger('rt1_model') rather than use this function.

param level:

The log level of the handler.

type level:

{“notset”, “debug”, “info”, “warning”, “error”, “critical”} or int

param fmt:

A short-name or a logging format-string.

Available short-names:

  • “plain”: message

  • “basic”: <TIME>: message

  • “timed”: <TIME>: <LEVEL>: message

  • “debug”: <TIME>: <LEVEL>: <MODULE>: message

The default is logging.BASIC_FORMAT

>>> "%(levelname)s:%(name)s:%(message)s"
type fmt:

str

Notes

The first time this function is called, an additional handler is attached to the root handler of rt1_model; this handler is reused every time and this function simply manipulates the logger and handler’s level.