Logging Configuration

Module init code.

configure_logging(level=None, tags_filter=None, overrides=None)[source]

Configure Python logging for SKA applications.

This function should be used to configure the application’s logging system as early as possible at start up.

Note

For Python TANGO devices that inherit from ska_tango_base.SKABaseDevice this is already done in that base class, so it does not need to be done again.

Example usage is shown in this repo’s README.md file.

Parameters

levelstr or int, optional

Set the logging level to this instead of the default. Use the string representations like “”INFO” and “DEBUG”, or integer values like logging.INFO and logging.DEBUG.

tags_filtertype derived from logging.Filter, optional

If this type (not instance) is provided, the default formatter will include a “%(tags)s” specifier. The filter must inject the tags attribute in each record.

overridesdict, optional

The default logging configuration can be modified by passing in this dict. It will be recursively merged with the default. This allows existing values to be modified, or even removed. It also allows additional loggers, handlers, filters and formatters to be added. See the _override function for more details on the merging process. The end result must be compatible with the logging.config.dictConfig schema. Note that the level and tags_filter parameter are applied after merging the overrides.

get_default_formatter(tags=False)[source]

Return a formatter configured with the standard logging format.

Parameters

tagsbool, optional

If true, then include the “tags” field in the format string. This requires a tags filter to be linked to the corresponding handler.

Returns

logging.Formatter

A new default formatter.