5.2.1 draco.logger -- the Logger object

Draco has an integrated logging subsystem that logs messages to a log file named error.log in the document root of the web site. This logfile is used by Draco itself to log problems it encounters and users are encouraged to make use of this facility too.

The logging is implemented by a Logger object. The global instance of this object is stored in the current module under the name logger. The following code fragment illustrates this:

from draco.logger import logger

class Logger( )
Global Draco object that provides a logging facility.

The public members of Logger are:

debug( message[, args])
Log the debug message message to the error log. Debug messages have the lowest priority of all log messages. The optional args parameter can specify a tuple of arguments that is applied to message with the format operator (%).

Note: If you need to log a longer message, you can pass a multiline string as the message parameter. All methods of the Logger class will recognise this and properly strip superfluous indentation. This is also the reason that you can separately pass format arguments. The formatting is done after the stripping of indentation, which means that you can safely pass multiline arguments to the indented format string.

info( message[, args])
Log the informational message message to the error log. An informational message has a higher priority than a debug message.

warn( message[, args])
Log the warning message message to the error log. A warning message has a higher priority than a informational message.

error( message[, args])
Log the error message message to the error log. An error message has the highest priority of all log messages.