Logo Search packages:      
Sourcecode: pythoncard version File versions  Download package

PythonCard-0.8.1::log::Log Class Reference

List of all members.

Detailed Description

A simple file logging class.  In the future we should
use this class to wrap up log4p.

The name of the log file is specified in PythonCard's 
configuration file, 'pythoncard.rsrc.py'

The log file will be created in the current working directory.

Each time PythonCard runs, it deletes the old log contents.

Log has four levels: DEBUG, ERROR, INFO and WARNING.

Using Log:

    Call Log.getInstance() to get a reference to
    the single Log instance:

        log = Log.getInstance()

    Logging is initially disabled.  To turn logging on:


    To turn logging off:


    To selectively enable one or more logging levels:

        log.enableLevels( [ Log.ERROR, Log.WARNING ] )

    To selectively disable one or more logging levels:

        log.disableLevels( [ Log.DEBUG, Log.INFO ] )

    To write to the Log:

        log.debug( 'a debug message' )
        log.error( 'an error message' )
        log.info( 'an info message' )
        log.warning( 'a warning message' )

        NOTE: The debug(), error(), info(), and warning() methods
              can be called with any number of parameters, and
              the parameters can be of any type.  For example, if you
              want to print a debug message that is a string,
              and a list of items you can call:

                  items = [ 'one', 'two', 3 ]

                  log.debug( 'the items are: ', items )

Definition at line 10 of file log.py.

Public Member Functions

def __init__
def debug
def disable
def disableLevels
def enable
def enableLevels
def error
def info
def isEnabled
def levelIsLegal
def warning
def write

Public Attributes


Static Public Attributes

string DEBUG = 'debug'
string ERROR = 'error'
tuple getInstance = LogSingletonHelper()
string INFO = 'info'
 instance = None
string WARNING = 'warning'


class  LogSingletonHelper

The documentation for this class was generated from the following file:

Generated by  Doxygen 1.6.0   Back to index