Logger (gb.logging)
This class provides the basic mechanism for sending messages to a log.
As you can create as many Logger objects as you like, this component provides an excellent means
to manage multiple active logs.
For a more advanced usage, you can use a
ComplexLogger to define multiple
Output, or even define your own, like sending the data over a TCP connection!
This class can be used like an object by creating a hidden instance on demand.
This class is
creatable .
This class can be used as a
function .
Constants
Critical
Constant that defines a log message as Critical.
Debug
Constant that defines a log message as being of Debug information level.
Error
Constant that defines a log message as being of Error level.
Info
Constant that defines a log message as being of Info (informational) level.
Stderr
Constant that defines a log message as being of standard error level.
Stdout
Constant that defines a log message as being of standard output level.
Warning
Constant that defines a log message as being of Warning level.
Properties
Enabled
Returns or sets the status of the
Logger. If set to False, every call to
Log will be ignored.
Format
Sets or returns the format for log messages produced by the
Logger object.
Level
Sets or returns the minimum logging level for the
Logger object.
The levels are defined by the component's constants, viz
Output
Returns the path to where the log is being saved.
Methods
Begin
Initializes the
Logger. You need to call this method before logging anything, it will make sure that the
Output file is available and ready to be written.
Log
Writes
sMessage to the log file, or to the defined output if the call to
isEnabledFor returns True for the level
iLevel .
isEnabledFor
Returns whether the
Logger object is enabled for (i.e. will not ignore messages for) the message level
specified by
iLevel.