casagui.utils._logging

Use the python logging interface for casagui logs. If casalog is available, then send log messages to it. Otherwise, use the base python logging mechanisms.

Module Contents

Classes

CasalogHandler

Logs to casalog, as appropriate

CasalogLogger

Instances of the Logger class represent a single logging channel. A

Functions

get_logger()

Returns the singleton logger instance.

class casagui.utils._logging.CasalogHandler(level=NOTSET)

Logs to casalog, as appropriate

setLevel(level_or_levelname)

Set the logging level of this handler. level must be an int or a str.

emit(record)

Do whatever it takes to actually log the specified logging record.

This version is intended to be implemented by subclasses and so raises a NotImplementedError.

class casagui.utils._logging.CasalogLogger(name, level=NOTSET)

Instances of the Logger class represent a single logging channel. A “logging channel” indicates an area of an application. Exactly how an “area” is defined is up to the application developer. Since an application can have any number of areas, logging channels are identified by a unique string. Application areas can be nested (e.g. an area of “input processing” might include sub-areas “read CSV files”, “read XLS files” and “read Gnumeric files”). To cater for this natural nesting, channel names are organized into a namespace hierarchy where levels are separated by periods, much like the Java or Python package namespace. So in the instance given above, channel names might be “input” for the upper level, and “input.csv”, “input.xls” and “input.gnu” for the sub-levels. There is no arbitrary limit to the depth of nesting.

setLevel(level)

Set the logging level of this logger. level must be an int or a str.

casagui.utils._logging.get_logger()

Returns the singleton logger instance.