Module Interface

Starting Logging

Note

See the Overview for more information on the parameters specified here.

cx_Logging.StartLogging(fileName, level, maxFiles = 1, maxFileSize = 1048576, prefix = "%t", reuse = True, rotate = True)

Start logging to the specified file at the specified level.

cx_Logging.StartLoggingForThread(fileName, level, maxFiles = 1, maxFileSize = 1048576, prefix = "%t", reuse = True, rotate = True)

Start logging to the specified file at the specified level, but only for the current Python thread.

cx_Logging.StartLoggingStderr(level, prefix = "%t")

Start logging to stderr at the specified level.

cx_Logging.StartLoggingStdout(level, prefix = "%t")

Start logging to stdout at the specified level.

Stopping Logging

cx_Logging.StopLogging()

Stop logging.

cx_Logging.StopLoggingForThread()

Stop logging for the given Python thread.

Logging Messages

cx_Logging.Critical(format, *args)

Log a message at the CRITICAL level. The format and arguments are the standard Python format.

cx_Logging.Debug(format, *args)

Log a message at the DEBUG level. The format and arguments are the standard Python format.

cx_Logging.Error(format, *args)

Log a message at the ERROR level. The format and arguments are the standard Python format.

cx_Logging.Info(format, *args)

Log a message at the INFO level. The format and arguments are the standard Python format.

cx_Logging.Log(level, format, *args)

Log a message at the specified level. The format and arguments are the standard Python format.

cx_Logging.Trace(format, *args)

Log a message regardless of the current level. The format and arguments are the standard Python format.

cx_Logging.Warning(level, format, *args)

Log a message at the WARNING level. The format and arguments are the standard Python format.

Logging Exceptions

cx_Logging.LogException([value, configuredExcBaseClass])

Log the exception just raised. The value is either a string (in which case the exception will be retrieved from the thread state) or the value is a configured exception (in which case it will be used directly). Not specifying either will use the information specified in SetExceptionInfo() instead and if that is not specified default values will be used.

cx_Logging.SetExceptionInfo(baseClass[, builder, message])

Define the behavior that specifies how exceptions are logged. The first parameter specifies the base class of exceptions that are logged in a special way and once specified does not need to be specified in the method LogException(). The second parameter specifies a method to call to build an instance of the base class if the exception is not already an instance of that class. The last parameter specifies the message that is logged immediately prior to logging the exception.

Logging State

cx_Logging.GetEncoding()

Return the encoding currently in place for logging Unicode objects.

cx_Logging.GetLoggingFile()

Return the file object to which logging is currently taking place.

cx_Logging.GetLoggingFileName()

Return the name of the file to which logging is currently taking place.

cx_Logging.GetLoggingLevel()

Return the current logging level.

cx_Logging.GetLoggingState()

Return the current logging state.

cx_Logging.SetEncoding(encoding)

Set the encoding to use for logging Unicode objects.

cx_Logging.SetLoggingLevel(level)

Set the current logging level.

cx_Logging.SetLoggingState(state)

Set the current logging state.

Constants

cx_Logging.buildtime

The date and time when the module was built.

cx_Logging.CRITICAL

The level at which critical errors are logged.

cx_Logging.DEBUG

The level at which debugging messages are logged.

cx_Logging.ENV_NAME_FILE_NAME

The environment variable name used for defining the file to which messages are to be logged.

cx_Logging.ENV_NAME_LEVEL

The environment variable name used for defining the level at which messages are to be logged.

cx_Logging.ENV_NAME_MAX_FILES

The environment variable name used for defining the maximum number of files to use in the rotating logging scheme.

cx_Logging.ENV_NAME_MAX_FILE_SIZE

The environment variable name used for defining the maximum size of files before the files are rotated.

cx_Logging.ENV_NAME_PREFIX

The environment variable name used for defining the prefix to use for all messages.

cx_Logging.ERROR

The level at which errors are logged.

cx_Logging.INFO

The level at which information messages are logged.

cx_Logging.NONE

The level at which no messages are logged.

cx_Logging.version

The version of the module.

cx_Logging.WARNING

The level at which warning messages are logged.