logging — Message logging functionality.

This module implements the ADMIT logging infrastructure.

class admit.util.AdmitLogging.AdmitLogging[source]

This is effectively a static class for the logging in ADMIT. It relies on the Python logging module and has the same logging calls as that module but also offers header and subheader methods which allow for annotation in the log.

Parameters:None

Attributes

None  

Methods

Formatter([fmt, datefmt]) Method to set the format of the logging messages
StreamHandler([stream]) Method to get a streamhandler object
addHandler(handler) Method to add a handler to the logger
addLevelName(level, levelName) Method to add a new level to the logging schema
basicConfig(\*\*kwargs) Method to initialize the basic logging module
critical(message) Method to emit a critial level message to the log(s)
debug(message) Method to emit a debug level message to the log(s)
error(message) Method to emit an error level message to the log(s)
findLogger() Method to get the appropriate logger.
getEffectiveLevel() Method to get the current minimum logging level
heading(message) Method to emit a header message to the log(s).
info(message) Method to emit an info level message to the log(s)
init(name, logfile, level) Method to initialize a new named logger
log(level, message) Method to emit a log message to the log(s) at the given level
regression(message) Method to emit a regression message to the log(s)
reportKeywords(kw) Method to emit logging messages that report the current state of the AT keywords.
setLevel(level) Method to set the current minimum level that will be logged all messages below this level are ignored.
shutdown() Method to shuitdown the logging system
subheading(message) Method to emit a subheader message to the log(s).
timing(message) Method to emit a timing message to the log(s)
warning(message) Method to emit a warning level message to the log(s)
CRITICAL = 50
DEBUG = 10
EFFECTIVELOGLEVEL = 20
ERROR = 40
static Formatter(fmt=None, datefmt=None)[source]

Method to set the format of the logging messages

Parameters:

fmt : str

The format of the messages

datefmt : str

The format for any dates in the log

Returns:

Handle to the format object

INFO = 20
REGRESSION = 21
static StreamHandler(stream=None)[source]

Method to get a streamhandler object

Parameters:

stream : stream

The output stream to attache to the stream handler

Returns:

Handler object

TIMING = 15
WARNING = 30
static addHandler(handler)[source]

Method to add a handler to the logger

Parameters:

handler : handle to a handler

The handler to add

Returns:

None

static addLevelName(level, levelName)[source]

Method to add a new level to the logging schema

Parameters:

level : int

The level number to add

levelName : str

The name to use for the level

Returns:

None

static basicConfig(**kwargs)[source]

Method to initialize the basic logging module

Parameters:various
Returns:None
static critical(message)[source]

Method to emit a critial level message to the log(s)

Parameters:

message : str

The message to sed to the log

Returns:

None

static debug(message)[source]

Method to emit a debug level message to the log(s)

Parameters:

message : str

The message to sed to the log

Returns:

None

static error(message)[source]

Method to emit an error level message to the log(s)

Parameters:

message : str

The message to sed to the log

Returns:

None

static findLogger()[source]

Method to get the appropriate logger. This is done by inspecting the stack, looking for either Admit.py or AT.py, both of which have the name of their loggers.

Parameters:None
Returns:Instance of the logger (or None)
static getEffectiveLevel()[source]

Method to get the current minimum logging level

Parameters:None
Returns:int continaing the current minimum logging level
static heading(message)[source]

Method to emit a header message to the log(s). Header messages are encapsulated in empty lines for emphasis

Parameters:

message : str

The message to sed to the log

Returns:

None

static info(message)[source]

Method to emit an info level message to the log(s)

Parameters:

message : str

The message to sed to the log

Returns:

None

static init(name, logfile, level)[source]

Method to initialize a new named logger

Parameters:

name : str

Unique name of the logger

logfile : str

Full path to the log file to generate

level : int

The initial logging level to set. All messages at or above this level will be emitted.

Returns:

None

static log(level, message)[source]

Method to emit a log message to the log(s) at the given level

Parameters:

level : int

The logging level to send the message at

message : str

The message to sed to the log

Returns:

None

loggers = set([])
static regression(message)[source]

Method to emit a regression message to the log(s)

It is suggested to start the message with a magic word followed by a colon, so top level scripts can reliably parse them. It is typically not needed to add verbosely what these numbers are, just the numbers are fine, the associated label defines them elsewhere. An example of use:

logging.regression(‘CUBEFLUX: %g %g’ % (flux1,flux2))

Parameters:

message : str

The message to send to the log

Returns:

None

static reportKeywords(kw)[source]

Method to emit logging messages that report the current state of the AT keywords.

Parameters:

kw : dict

A dictionary containing the AT _keys dictionary

Returns:

None

static setLevel(level)[source]

Method to set the current minimum level that will be logged all messages below this level are ignored.

Parameters:

level : int

The numeric level number to set

Returns:

None

static shutdown()[source]

Method to shuitdown the logging system

Parameters:None
Returns:None
static subheading(message)[source]

Method to emit a subheader message to the log(s). Subheader messages are encapsulated in an empty line for emphasis

Parameters:

message : str

The message to sed to the log

Returns:

None

static timing(message)[source]

Method to emit a timing message to the log(s)

Parameters:

message : str

The message to send to the log

Returns:

None

static warning(message)[source]

Method to emit a warning level message to the log(s)

Parameters:

message : str

The message to sed to the log

Returns:

None