cement.core.log

Cement core log module.

class cement.core.log.CementLogHandler(*args, **kw)

Bases: cement.core.handler.CementBaseHandler

Base class that all Log Handlers should sub-class from.

class Meta

Handler meta-data (can be passed as keyword arguments to the parent class).

interface

The interface that this class implements.

alias of ILog

label = None

The string identifier of this handler.

class cement.core.log.ILog

Bases: cement.core.interface.Interface

This class defines the Log Handler Interface. Classes that implement this handler must provide the methods and attributes defined below.

Implementations do not subclass from interfaces.

Usage:

from cement.core import log

class MyLogHandler(object):
    class Meta:
        interface = log.ILog
        label = 'my_log_handler'
    ...
class IMeta

Interface meta-data.

label = 'log'

The string identifier of the interface.

validator(obj)

The interface validator function.

_setup()

The _setup function is called during application initialization and must ‘setup’ the handler object making it ready for the framework or the application to make further calls to it.

Parameters:app_obj – The application object.
debug(msg)

Log to the ‘DEBUG’ facility.

Parameters:msg – The message to log.
error(msg)

Log to the ‘ERROR’ facility.

Parameters:msg – The message to log.
fatal(msg)

Log to the ‘FATAL’ facility.

Parameters:msg – The message to log.
get_level()

Return a string representation of the log level.

info()

Log to the ‘INFO’ facility.

Parameters:msg – The message to log.
set_level()
Set the log level. Must except atleast one of:
['INFO', 'WARNING', 'ERROR', 'DEBUG', or 'FATAL'].
warning(msg)

Log to the ‘WARNING’ facility.

Parameters:msg – The message to log.
cement.core.log.log_validator(klass, obj)

Validates an handler implementation against the ILog interface.