Anthony Tuininga avatar Anthony Tuininga committed e661540

Ensure that all source files have the property for line endings set to native;
convert all tabs to spaces.

Comments (0)

Files changed (6)

 Metadata-Version: 1.0
 Name: cx_Logging
-Version: 1.3
-Summary: Python interface for logging
+Version: HEAD
 Home-page: http://starship.python.net/crew/atuining
 Author: Anthony Tuininga
 Author-email: anthony.tuininga@gmail.com
-License: See LICENSE.txt
-Description: Python interface for logging
-Platform: UNKNOWN
+Maintainer: Anthony Tuininga
+Maintainer-email: anthony.tuininga@gmail.com
+Summary: Python and C interfaces for logging
+Description: Python and C interfaces for logging
+Keywords: logging
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Intended Audience :: Developers
+Classifier: License :: OSI Approved :: Python Software Foundation License
+Classifier: Natural Language :: English
+Classifier: Operating System :: OS Independent
+Classifier: Programming Language :: C
+Classifier: Programming Language :: Python
+Classifier: Topic :: Software Development :: Libraries :: Python Modules
+Classifier: Topic :: Utilities
 #include <sys/stat.h>
 #endif
 
-#define THREAD_STATE_KEY	"cx_Logging"
-#define ENV_NAME_FILE_NAME	"CX_LOGGING_FILE_NAME"
-#define ENV_NAME_LEVEL		"CX_LOGGING_LEVEL"
-#define ENV_NAME_MAX_FILES	"CX_LOGGING_MAX_FILES"
-#define ENV_NAME_MAX_FILE_SIZE	"CX_LOGGING_MAX_FILE_SIZE"
-#define ENV_NAME_PREFIX		"CX_LOGGING_PREFIX"
-#define THREAD_FORMAT		"%.5ld"
-#define DATE_FORMAT		"%.4d/%.2d/%.2d"
-#define TIME_FORMAT		"%.2d:%.2d:%.2d.%.3d"
-#define TICKS_FORMAT		"%.10d"
+#define THREAD_STATE_KEY        "cx_Logging"
+#define ENV_NAME_FILE_NAME      "CX_LOGGING_FILE_NAME"
+#define ENV_NAME_LEVEL          "CX_LOGGING_LEVEL"
+#define ENV_NAME_MAX_FILES      "CX_LOGGING_MAX_FILES"
+#define ENV_NAME_MAX_FILE_SIZE  "CX_LOGGING_MAX_FILE_SIZE"
+#define ENV_NAME_PREFIX         "CX_LOGGING_PREFIX"
+#define THREAD_FORMAT           "%.5ld"
+#define DATE_FORMAT             "%.4d/%.2d/%.2d"
+#define TIME_FORMAT             "%.2d:%.2d:%.2d.%.3d"
+#define TICKS_FORMAT            "%.10d"
 
 
 // define platform specific methods for manipulating locks
 #ifdef WIN32
 #include <malloc.h>
-#define INITIALIZE_LOCK(lock)	InitializeCriticalSection(&lock)
-#define ACQUIRE_LOCK(lock)	EnterCriticalSection(&lock)
-#define RELEASE_LOCK(lock)	LeaveCriticalSection(&lock)
+#define INITIALIZE_LOCK(lock)   InitializeCriticalSection(&lock)
+#define ACQUIRE_LOCK(lock)      EnterCriticalSection(&lock)
+#define RELEASE_LOCK(lock)      LeaveCriticalSection(&lock)
 #else
-#define INITIALIZE_LOCK(lock)	sem_init(&lock, 0, 1)
-#define ACQUIRE_LOCK(lock)	sem_wait(&lock)
-#define RELEASE_LOCK(lock)	sem_post(&lock)
+#define INITIALIZE_LOCK(lock)   sem_init(&lock, 0, 1)
+#define ACQUIRE_LOCK(lock)      sem_wait(&lock)
+#define RELEASE_LOCK(lock)      sem_post(&lock)
 #endif
 
 // define macro to get the build version as a string
-#define xstr(s)			str(s)
-#define str(s)			#s
-#define BUILD_VERSION_STRING	xstr(BUILD_VERSION)
+#define xstr(s)                 str(s)
+#define str(s)                  #s
+#define BUILD_VERSION_STRING    xstr(BUILD_VERSION)
 
 
 // define Py_ssize_t for versions before Python 2.5
 //   Write the level to the file.
 //-----------------------------------------------------------------------------
 static int WriteLevel(
-    LoggingState *state,		// state to use for writing
-    unsigned long level)		// level to write to the file
+    LoggingState *state,                // state to use for writing
+    unsigned long level)                // level to write to the file
 {
     char temp[20];
     int result;
 //   Write the prefix to the file.
 //-----------------------------------------------------------------------------
 static int WritePrefix(
-    LoggingState *state,		// state to use for writing
-    unsigned long level)		// level at which to write
+    LoggingState *state,                // state to use for writing
+    unsigned long level)                // level at which to write
 {
 #ifdef WIN32
     SYSTEMTIME time;
 // if keeping it would exceed the maximum number of files to keep.
 //-----------------------------------------------------------------------------
 static int SwitchLogFiles(
-    LoggingState *state)		// state to use
+    LoggingState *state)                // state to use
 {
     unsigned long lastFileFound, i;
     struct stat statBuffer;
 // if so, starts a new one.
 //-----------------------------------------------------------------------------
 static int CheckForLogFileFull(
-    LoggingState *state)		// state to use for writing
+    LoggingState *state)                // state to use for writing
 {
     long position;
 
 //   Write the message to the file.
 //-----------------------------------------------------------------------------
 static int WriteMessage(
-    LoggingState *state,		// state to use for writing
-    unsigned long level,		// level at which to write
-    const char *message)		// message to write
+    LoggingState *state,                // state to use for writing
+    unsigned long level,                // level at which to write
+    const char *message)                // message to write
 {
 #ifndef UNDER_CE
     if (CheckForLogFileFull(state) < 0)
 // arguments.
 //-----------------------------------------------------------------------------
 static int WriteMessageWithFormat(
-    LoggingState *state,		// state to stop logging for
-    unsigned long level,		// level at which message is written
-    const char *format,			// format of message to log
-    va_list arguments)			// argument list
+    LoggingState *state,                // state to stop logging for
+    unsigned long level,                // level at which message is written
+    const char *format,                 // format of message to log
+    va_list arguments)                  // argument list
 {
 #ifndef UNDER_CE
     if (CheckForLogFileFull(state) < 0)
 // acquiring and releasing the lock twice would be detrimental to performance.
 //-----------------------------------------------------------------------------
 static int IsLoggingAtLevelForPython(
-    unsigned long level)		// desired level
+    unsigned long level)                // desired level
 {
     udt_LoggingState *loggingState;
     int result;
 //   Write a message for Python given the known logging state.
 //-----------------------------------------------------------------------------
 static int WriteMessageForPython(
-    unsigned long level,		// level at which message is written
-    const char *message)		// message to write
+    unsigned long level,                // level at which message is written
+    const char *message)                // message to write
 {
     udt_LoggingState *loggingState;
     int result = 0;
 //   Free the logging state.
 //-----------------------------------------------------------------------------
 static void LoggingState_Free(
-    LoggingState *state)		// state to stop logging for
+    LoggingState *state)                // state to stop logging for
 {
     if (state->fp) {
         if (state->fileOwned) {
 // initial log messages to it.
 //-----------------------------------------------------------------------------
 static int LoggingState_OnCreate(
-    LoggingState *state)		// logging state just created
+    LoggingState *state)                // logging state just created
 {
     struct stat statBuffer;
 
 //   Create a new logging state.
 //-----------------------------------------------------------------------------
 static LoggingState* LoggingState_New(
-    FILE *fp,				// file to associate
-    const char *fileName,		// name of file to open
-    unsigned long level,		// level to use
-    unsigned long maxFiles,		// maximum number of files
-    unsigned long maxFileSize,		// maximum size of each file
-    const char *prefix)			// prefix to use
+    FILE *fp,                           // file to associate
+    const char *fileName,               // name of file to open
+    unsigned long level,                // level to use
+    unsigned long maxFiles,             // maximum number of files
+    unsigned long maxFileSize,          // maximum size of each file
+    const char *prefix)                 // prefix to use
 {
     LoggingState *state;
     char *tmp;
 //   Set the level for the logging state.
 //-----------------------------------------------------------------------------
 static int LoggingState_SetLevel(
-    LoggingState *state,		// state on which to change level
-    unsigned long newLevel)		// new level to set
+    LoggingState *state,                // state on which to change level
+    unsigned long newLevel)             // new level to set
 {
     if (WritePrefix(state, LOG_LEVEL_NONE) < 0)
         return -1;
 //   Called when a Python logging state variable is freed.
 //-----------------------------------------------------------------------------
 void PythonLoggingState_Free(
-    udt_LoggingState *self)		// object being freed
+    udt_LoggingState *self)             // object being freed
 {
     if (self->state) {
         LoggingState_Free(self->state);
 // define logging state Python type
 static PyTypeObject gPythonLoggingStateType = {
     PyObject_HEAD_INIT(NULL)
-    0,					// ob_size
-    "cx_Logging.LoggingState",		// tp_name
-    sizeof(udt_LoggingState),		// tp_basicsize
-    0,					// tp_itemsize
+    0,                                  // ob_size
+    "cx_Logging.LoggingState",          // tp_name
+    sizeof(udt_LoggingState),           // tp_basicsize
+    0,                                  // tp_itemsize
     (destructor) PythonLoggingState_Free,
-					// tp_dealloc
-    0,					// tp_print
-    0,					// tp_getattr
-    0,					// tp_setattr
-    0,					// tp_compare
-    0,					// tp_repr
-    0,					// tp_as_number
-    0,					// tp_as_sequence
-    0,					// tp_as_mapping
-    0,					// tp_hash
-    0,					// tp_call
-    0,					// tp_str
-    0,					// tp_getattro
-    0,					// tp_setattro
-    0,					// tp_as_buffer
-    Py_TPFLAGS_DEFAULT,			// tp_flags
-    0,					// tp_doc
-    0,					// tp_traverse
-    0,					// tp_clear
-    0,					// tp_richcompare
-    0,					// tp_weaklistoffset
-    0,					// tp_iter
-    0,					// tp_iternext
-    0,					// tp_methods
-    0,					// tp_members
-    0,					// tp_getset
-    0,					// tp_base
-    0,					// tp_dict
-    0,					// tp_descr_get
-    0,					// tp_descr_set
-    0,					// tp_dictoffset
-    0,					// tp_init
-    0,					// tp_alloc
-    0,					// tp_new
-    0,					// tp_free
-    0,					// tp_is_gc
-    0					// tp_bases
+                                        // tp_dealloc
+    0,                                  // tp_print
+    0,                                  // tp_getattr
+    0,                                  // tp_setattr
+    0,                                  // tp_compare
+    0,                                  // tp_repr
+    0,                                  // tp_as_number
+    0,                                  // tp_as_sequence
+    0,                                  // tp_as_mapping
+    0,                                  // tp_hash
+    0,                                  // tp_call
+    0,                                  // tp_str
+    0,                                  // tp_getattro
+    0,                                  // tp_setattro
+    0,                                  // tp_as_buffer
+    Py_TPFLAGS_DEFAULT,                 // tp_flags
+    0,                                  // tp_doc
+    0,                                  // tp_traverse
+    0,                                  // tp_clear
+    0,                                  // tp_richcompare
+    0,                                  // tp_weaklistoffset
+    0,                                  // tp_iter
+    0,                                  // tp_iternext
+    0,                                  // tp_methods
+    0,                                  // tp_members
+    0,                                  // tp_getset
+    0,                                  // tp_base
+    0,                                  // tp_dict
+    0,                                  // tp_descr_get
+    0,                                  // tp_descr_set
+    0,                                  // tp_dictoffset
+    0,                                  // tp_init
+    0,                                  // tp_alloc
+    0,                                  // tp_new
+    0,                                  // tp_free
+    0,                                  // tp_is_gc
+    0                                   // tp_bases
 };
 
 
 //   Start logging to the specified file.
 //-----------------------------------------------------------------------------
 CX_LOGGING_API int StartLogging(
-    const char *fileName,		// name of file to write to
-    unsigned long level,		// level to use for logging
-    unsigned long maxFiles,		// maximum number of files to have
-    unsigned long maxFileSize,		// maximum size of each file
-    const char *prefix)			// prefix to use in logging
+    const char *fileName,               // name of file to write to
+    unsigned long level,                // level to use for logging
+    unsigned long maxFiles,             // maximum number of files to have
+    unsigned long maxFileSize,          // maximum size of each file
+    const char *prefix)                 // prefix to use in logging
 {
     LoggingState *loggingState, *origLoggingState;
 
 // assumed at this point that the Python interpreter lock is held.
 //-----------------------------------------------------------------------------
 CX_LOGGING_API int StartLoggingForPythonThread(
-    const char *fileName,		// name of file to write to
-    unsigned long level,		// level to use for logging
-    unsigned long maxFiles,		// maximum number of files to have
-    unsigned long maxFileSize,		// maximum size of each file
-    const char *prefix)			// prefix to use in logging
+    const char *fileName,               // name of file to write to
+    unsigned long level,                // level to use for logging
+    unsigned long maxFiles,             // maximum number of files to have
+    unsigned long maxFileSize,          // maximum size of each file
+    const char *prefix)                 // prefix to use in logging
 {
     udt_LoggingState *loggingState;
     int result;
 //   Start logging to stderr.
 //-----------------------------------------------------------------------------
 CX_LOGGING_API int StartLoggingStderr(
-    unsigned long level,		// level to use for logging
-    const char *prefix)			// prefix to use for logging
+    unsigned long level,                // level to use for logging
+    const char *prefix)                 // prefix to use for logging
 {
     LoggingState *loggingState, *origLoggingState;
 
 //   Start logging to stdout.
 //-----------------------------------------------------------------------------
 CX_LOGGING_API int StartLoggingStdout(
-    unsigned long level,		// level to use for logging
-    const char *prefix)			// prefix to use for logging
+    unsigned long level,                // level to use for logging
+    const char *prefix)                 // prefix to use for logging
 {
     LoggingState *loggingState, *origLoggingState;
 
 // as a va_list.
 //-----------------------------------------------------------------------------
 CX_LOGGING_API int LogMessageVaList(
-    unsigned long level,		// level to check for
-    const char *format,			// format of message to log
-    va_list arguments)			// argument list
+    unsigned long level,                // level to check for
+    const char *format,                 // format of message to log
+    va_list arguments)                  // argument list
 {
     int result = 0;
 
 //   Log a message to the log file with a variable number of arguments.
 //-----------------------------------------------------------------------------
 CX_LOGGING_API int LogMessageV(
-    unsigned long level,		// level at which to log
-    const char *format,			// format of message to log
-    ...)				// arguments required for format
+    unsigned long level,                // level at which to log
+    const char *format,                 // format of message to log
+    ...)                                // arguments required for format
 {
     va_list arguments;
     int result;
 // this thread is desired; if not, the normal LogMessageV() is invoked.
 //-----------------------------------------------------------------------------
 CX_LOGGING_API int LogMessageForPythonV(
-    unsigned long level,		// level at which to log
-    const char *format,			// format of message to log
-    ...)				// arguments required for format
+    unsigned long level,                // level at which to log
+    const char *format,                 // format of message to log
+    ...)                                // arguments required for format
 {
     udt_LoggingState *loggingState;
     va_list arguments;
 //   Log a message to the log file.
 //-----------------------------------------------------------------------------
 CX_LOGGING_API int LogMessage(
-    unsigned long level,		// level at which to log
-    const char *message)		// message to log
+    unsigned long level,                // level at which to log
+    const char *message)                // message to log
 {
     int result = 0;
 
 //   Log a message at level LOG_LEVEL_DEBUG to the log file.
 //-----------------------------------------------------------------------------
 CX_LOGGING_API int LogDebug(
-    const char *message)		// message to log
+    const char *message)                // message to log
 {
     return LogMessage(LOG_LEVEL_DEBUG, message);
 }
 //   Log a message at level LOG_LEVEL_INFO to the log file.
 //-----------------------------------------------------------------------------
 CX_LOGGING_API int LogInfo(
-    const char *message)		// message to log
+    const char *message)                // message to log
 {
     return LogMessage(LOG_LEVEL_INFO, message);
 }
 //   Log a message at level LOG_LEVEL_WARNING to the log file.
 //-----------------------------------------------------------------------------
 CX_LOGGING_API int LogWarning(
-    const char *message)		// message to log
+    const char *message)                // message to log
 {
     return LogMessage(LOG_LEVEL_WARNING, message);
 }
 //   Log a message at level LOG_LEVEL_ERROR to the log file.
 //-----------------------------------------------------------------------------
 CX_LOGGING_API int LogError(
-    const char *message)		// message to log
+    const char *message)                // message to log
 {
     return LogMessage(LOG_LEVEL_ERROR, message);
 }
 //   Log a message at level LOG_LEVEL_CRITICAL to the log file.
 //-----------------------------------------------------------------------------
 CX_LOGGING_API int LogCritical(
-    const char *message)		// message to log
+    const char *message)                // message to log
 {
     return LogMessage(LOG_LEVEL_CRITICAL, message);
 }
 //   Log a message regardless of the current logging level to the log file.
 //-----------------------------------------------------------------------------
 CX_LOGGING_API int LogTrace(
-    const char *message)		// message to log
+    const char *message)                // message to log
 {
     return LogMessage(LOG_LEVEL_NONE, message);
 }
 //   Set the current logging level.
 //-----------------------------------------------------------------------------
 CX_LOGGING_API int SetLoggingLevel(
-    unsigned long newLevel)		// new level to use
+    unsigned long newLevel)             // new level to use
 {
     int result = 0;
 
 //   Log an error message from the Win32 subsystem and return -1.
 //-----------------------------------------------------------------------------
 CX_LOGGING_API int LogWin32Error(
-    DWORD errorCode,			// Win32 error code to log
-    const char *message)		// message to log
+    DWORD errorCode,                    // Win32 error code to log
+    const char *message)                // message to log
 {
     DWORD status;
     char *buffer;
 //   Log a GUID in human readable format to the log file.
 //-----------------------------------------------------------------------------
 CX_LOGGING_API int LogGUID(
-    unsigned long level,		// level at which to log
-    const char *prefix,			// prefix to print in front of it
-    const IID *iid)			// interface to print
+    unsigned long level,                // level at which to log
+    const char *prefix,                 // prefix to print in front of it
+    const IID *iid)                     // interface to print
 {
     int strLength, result = 0;
     OLECHAR str[128];
 //   Log the string representation of the Python object to the log file.
 //-----------------------------------------------------------------------------
 CX_LOGGING_API int LogPythonObject(
-    unsigned long logLevel,		// log level
-    const char *prefix,			// prefix for message
-    const char *name,			// name to display
-    PyObject *object)			// object to log
+    unsigned long logLevel,             // log level
+    const char *prefix,                 // prefix for message
+    const char *name,                   // name to display
+    PyObject *object)                   // object to log
 {
     PyObject *stringRep;
     int result;
 //   Base method for logging a Python exception.
 //-----------------------------------------------------------------------------
 static int BaseLogPythonException(
-    const char *message,		// message to log
-    PyObject *type,			// exception type
-    PyObject *value)			// exception value
+    const char *message,                // message to log
+    PyObject *type,                     // exception type
+    PyObject *value)                    // exception value
 {
     LogMessageForPythonV(LOG_LEVEL_ERROR, "Python exception encountered:");
     LogMessageForPythonV(LOG_LEVEL_ERROR, "    Internal Message: %s", message);
 //   Log a Python exception without traceback.
 //-----------------------------------------------------------------------------
 static int LogPythonExceptionNoTraceback(
-    const char *message)		// message to log
+    const char *message)                // message to log
 {
     PyObject *type, *value, *traceback;
 
 // transformed into None values automatically.
 //-----------------------------------------------------------------------------
 static void SetArgumentValue(
-    PyObject *args,			// argument tuple to modify
-    int position,			// position in tuple to modify
-    PyObject *value)			// value to place in tuple
+    PyObject *args,                     // argument tuple to modify
+    int position,                       // position in tuple to modify
+    PyObject *value)                    // value to place in tuple
 {
     if (!value)
         value = Py_None;
 //   Log a Python exception with traceback, if possible.
 //-----------------------------------------------------------------------------
 CX_LOGGING_API int LogPythonExceptionWithTraceback(
-    const char *message,		// message to log
-    PyObject *type,			// exception type
-    PyObject *value,			// exception value
-    PyObject *traceback)		// exception traceback
+    const char *message,                // message to log
+    PyObject *type,                     // exception type
+    PyObject *value,                    // exception value
+    PyObject *traceback)                // exception traceback
 {
     PyObject *module, *method, *args, *result, *line;
     Py_ssize_t i, numElements;
 // that fails then without.
 //-----------------------------------------------------------------------------
 CX_LOGGING_API int LogPythonException(
-    const char *message)		// message to display
+    const char *message)                // message to display
 {
     PyObject *type, *value, *traceback;
 
 //   Log the message from error object.
 //-----------------------------------------------------------------------------
 static int LogMessageFromErrorObj(
-    unsigned long level,		// log level
-    PyObject *errorObj)			// error object to log
+    unsigned long level,                // log level
+    PyObject *errorObj)                 // error object to log
 {
     PyObject *message;
     char *buffer;
 //   Log the template id from the error object.
 //-----------------------------------------------------------------------------
 static int LogTemplateIdFromErrorObj(
-    unsigned long level,		// log level
-    PyObject *errorObj)			// error object to examine
+    unsigned long level,                // log level
+    PyObject *errorObj)                 // error object to examine
 {
     PyObject *templateId;
     int value;
 //   Log the arguments stored on the error object.
 //-----------------------------------------------------------------------------
 static int LogArgumentsFromErrorObj(
-    unsigned long level,		// log level
-    PyObject *errorObj)			// error object to examine
+    unsigned long level,                // log level
+    PyObject *errorObj)                 // error object to examine
 {
     PyObject *dict, *items, *item, *key, *value;
     Py_ssize_t i, size;
 //   Get the template id from the error object.
 //-----------------------------------------------------------------------------
 static int LogListOfStringsFromErrorObj(
-    unsigned long level,		// log level
-    PyObject *errorObj,			// error object to examine
-    char *attributeName,		// attribute name to examine
-    const char *header)			// header to log
+    unsigned long level,                // log level
+    PyObject *errorObj,                 // error object to examine
+    char *attributeName,                // attribute name to examine
+    const char *header)                 // header to log
 {
     Py_ssize_t i, size;
     PyObject *list;
 //   Log a configured Python exception.
 //-----------------------------------------------------------------------------
 CX_LOGGING_API int LogConfiguredException(
-    PyObject *errorObj)			// object to log
+    PyObject *errorObj)                 // object to log
 {
     unsigned long logLevel;
     PyObject *logLevelObj;
 // across thread boundaries.
 //-----------------------------------------------------------------------------
 CX_LOGGING_API int SetLoggingState(
-    udt_LoggingState *loggingState)	// logging state to set
+    udt_LoggingState *loggingState)     // logging state to set
 {
     PyObject *dict;
 
 //   Python implementation of LogMessage() where the level is already known.
 //-----------------------------------------------------------------------------
 static PyObject* LogMessageForPythonWithLevel(
-    unsigned long level,		// logging level
-    int startingIndex,			// starting index to look at
-    PyObject *args)			// Python arguments
+    unsigned long level,                // logging level
+    int startingIndex,                  // starting index to look at
+    PyObject *args)                     // Python arguments
 {
     PyObject *tempArgs, *temp, *format;
 
 //   Python implementation of LogMessage() exposed through the module.
 //-----------------------------------------------------------------------------
 static PyObject* LogMessageForPython(
-    PyObject *self,			// passthrough argument
-    PyObject *args)			// arguments
+    PyObject *self,                     // passthrough argument
+    PyObject *args)                     // arguments
 {
     unsigned long level;
     PyObject *tempArgs;
 //   Python implementation of Debug() exposed through the module.
 //-----------------------------------------------------------------------------
 static PyObject* LogDebugForPython(
-    PyObject *self,			// passthrough argument
-    PyObject *args)			// arguments
+    PyObject *self,                     // passthrough argument
+    PyObject *args)                     // arguments
 {
     return LogMessageForPythonWithLevel(LOG_LEVEL_DEBUG, 0, args);
 }
 //   Python implementation of Info() exposed through the module.
 //-----------------------------------------------------------------------------
 static PyObject* LogInfoForPython(
-    PyObject *self,			// passthrough argument
-    PyObject *args)			// arguments
+    PyObject *self,                     // passthrough argument
+    PyObject *args)                     // arguments
 {
     return LogMessageForPythonWithLevel(LOG_LEVEL_INFO, 0, args);
 }
 //   Python implementation of Warning() exposed through the module.
 //-----------------------------------------------------------------------------
 static PyObject* LogWarningForPython(
-    PyObject *self,			// passthrough argument
-    PyObject *args)			// arguments
+    PyObject *self,                     // passthrough argument
+    PyObject *args)                     // arguments
 {
     return LogMessageForPythonWithLevel(LOG_LEVEL_WARNING, 0, args);
 }
 //   Python implementation of Error() exposed through the module.
 //-----------------------------------------------------------------------------
 static PyObject* LogErrorForPython(
-    PyObject *self,			// passthrough argument
-    PyObject *args)			// arguments
+    PyObject *self,                     // passthrough argument
+    PyObject *args)                     // arguments
 {
     return LogMessageForPythonWithLevel(LOG_LEVEL_ERROR, 0, args);
 }
 //   Python implementation of Critical() exposed through the module.
 //-----------------------------------------------------------------------------
 static PyObject* LogCriticalForPython(
-    PyObject *self,			// passthrough argument
-    PyObject *args)			// arguments
+    PyObject *self,                     // passthrough argument
+    PyObject *args)                     // arguments
 {
     return LogMessageForPythonWithLevel(LOG_LEVEL_CRITICAL, 0, args);
 }
 //   Python implementation of Trace() exposed through the module.
 //-----------------------------------------------------------------------------
 static PyObject* LogTraceForPython(
-    PyObject *self,			// passthrough argument
-    PyObject *args)			// arguments
+    PyObject *self,                     // passthrough argument
+    PyObject *args)                     // arguments
 {
     return LogMessageForPythonWithLevel(LOG_LEVEL_NONE, 0, args);
 }
 //   Python implementation of StartLogging() exposed through the module.
 //-----------------------------------------------------------------------------
 static PyObject* StartLoggingForPython(
-    PyObject *self,			// passthrough argument
-    PyObject *args,			// arguments
-    PyObject *keywordArgs)		// keyword arguments
+    PyObject *self,                     // passthrough argument
+    PyObject *args,                     // arguments
+    PyObject *keywordArgs)              // keyword arguments
 {
     static char *keywordList[] = {"fileName", "level", "maxFiles",
             "maxFileSize", "prefix", NULL};
 //   Python implementation of StartLoggingStderr() exposed through the module.
 //-----------------------------------------------------------------------------
 static PyObject* StartLoggingStderrForPython(
-    PyObject *self,			// passthrough argument
-    PyObject *args)			// arguments
+    PyObject *self,                     // passthrough argument
+    PyObject *args)                     // arguments
 {
     unsigned long level;
     char *prefix;
 //   Python implementation of StartLoggingStdout() exposed through the module.
 //-----------------------------------------------------------------------------
 static PyObject* StartLoggingStdoutForPython(
-    PyObject *self,			// passthrough argument
-    PyObject *args)			// arguments
+    PyObject *self,                     // passthrough argument
+    PyObject *args)                     // arguments
 {
     unsigned long level;
     char *prefix;
 //   Python implementation of StartLoggingForThread().
 //-----------------------------------------------------------------------------
 static PyObject *StartLoggingForThreadForPython(
-    PyObject *self,			// passthrough argument
-    PyObject *args,			// arguments
-    PyObject *keywordArgs)		// keyword arguments
+    PyObject *self,                     // passthrough argument
+    PyObject *args,                     // arguments
+    PyObject *keywordArgs)              // keyword arguments
 {
     static char *keywordList[] = {"fileName", "level", "maxFiles",
             "maxFileSize", "prefix", NULL};
 //   Python implementation of StopLogging() exposed through the module.
 //-----------------------------------------------------------------------------
 static PyObject* StopLoggingForPython(
-    PyObject *self,			// passthrough argument
-    PyObject *args)			// arguments
+    PyObject *self,                     // passthrough argument
+    PyObject *args)                     // arguments
 {
     StopLogging();
     Py_INCREF(Py_None);
 //   Python implementation of StartLoggingForThread().
 //-----------------------------------------------------------------------------
 static PyObject *StopLoggingForThreadForPython(
-    PyObject *self,			// passthrough argument
-    PyObject *args)			// arguments
+    PyObject *self,                     // passthrough argument
+    PyObject *args)                     // arguments
 {
     StopLoggingForPythonThread();
     Py_INCREF(Py_None);
 //   Return the current logging level.
 //-----------------------------------------------------------------------------
 static PyObject* GetLoggingLevelForPython(
-    PyObject *self,			// passthrough argument
-    PyObject *args)			// arguments
+    PyObject *self,                     // passthrough argument
+    PyObject *args)                     // arguments
 {
     udt_LoggingState *loggingState;
 
 //   Set the logging level.
 //-----------------------------------------------------------------------------
 static PyObject* SetLoggingLevelForPython(
-    PyObject *self,			// passthrough argument
-    PyObject *args)			// arguments
+    PyObject *self,                     // passthrough argument
+    PyObject *args)                     // arguments
 {
     udt_LoggingState *loggingState;
     unsigned long newLevel;
 //   Return the current logging file as a Python object.
 //-----------------------------------------------------------------------------
 static PyObject* GetLoggingFileForPython(
-    PyObject *self,			// passthrough argument
-    PyObject *args)			// arguments
+    PyObject *self,                     // passthrough argument
+    PyObject *args)                     // arguments
 {
     udt_LoggingState *loggingState;
     PyObject *fileObj;
 //   Return the current logging file name.
 //-----------------------------------------------------------------------------
 static PyObject* GetLoggingFileNameForPython(
-    PyObject *self,			// passthrough argument
-    PyObject *args)			// arguments
+    PyObject *self,                     // passthrough argument
+    PyObject *args)                     // arguments
 {
     udt_LoggingState *loggingState;
     PyObject *fileNameObj;
 //   Return the current logging state for the thread.
 //-----------------------------------------------------------------------------
 static PyObject* GetLoggingStateForPython(
-    PyObject *self,			// passthrough argument
-    PyObject *args)			// arguments
+    PyObject *self,                     // passthrough argument
+    PyObject *args)                     // arguments
 {
     PyObject *loggingState;
 
 // GetLoggingStateForPython().
 //-----------------------------------------------------------------------------
 static PyObject* SetLoggingStateForPython(
-    PyObject *self,			// passthrough argument
-    PyObject *args)			// arguments
+    PyObject *self,                     // passthrough argument
+    PyObject *args)                     // arguments
 {
     udt_LoggingState *loggingState;
 
 // GetLoggingStateForPython().
 //-----------------------------------------------------------------------------
 static PyObject* LogExceptionForPython(
-    PyObject *self,			// passthrough argument
-    PyObject *args)			// arguments
+    PyObject *self,                     // passthrough argument
+    PyObject *args)                     // arguments
 {
     PyObject *value, *configuredExcBaseClass = NULL;
     PyThreadState *threadState = NULL;
 //   Start logging to the specified file.
 //-----------------------------------------------------------------------------
 CX_LOGGING_API int StartLoggingW(
-    const OLECHAR *fileName,		// name of file to write to
-    unsigned long level,		// level to use for logging
-    unsigned long maxFiles,		// maximum number of files to have
-    unsigned long maxFileSize,		// maximum size of each file
-    const OLECHAR *prefix)		// prefix to use in logging
+    const OLECHAR *fileName,            // name of file to write to
+    unsigned long level,                // level to use for logging
+    unsigned long maxFiles,             // maximum number of files to have
+    unsigned long maxFileSize,          // maximum size of each file
+    const OLECHAR *prefix)              // prefix to use in logging
 {
     char *tempFileName, *tempPrefix;
     unsigned size;
 //   Log a message to the log file.
 //-----------------------------------------------------------------------------
 CX_LOGGING_API int LogMessageW(
-    unsigned long level,		// level at which to log
-    const OLECHAR *message)		// message to log
+    unsigned long level,                // level at which to log
+    const OLECHAR *message)             // message to log
 {
     char *tempMessage;
     unsigned size;
 //   Log a message at level LOG_LEVEL_DEBUG to the log file.
 //-----------------------------------------------------------------------------
 CX_LOGGING_API int LogDebugW(
-    const OLECHAR *message)		// message to log
+    const OLECHAR *message)             // message to log
 {
     return LogMessageW(LOG_LEVEL_DEBUG, message);
 }
 //   Log a message at level LOG_LEVEL_INFO to the log file.
 //-----------------------------------------------------------------------------
 CX_LOGGING_API int LogInfoW(
-    const OLECHAR *message)		// message to log
+    const OLECHAR *message)             // message to log
 {
     return LogMessageW(LOG_LEVEL_INFO, message);
 }
 //   Log a message at level LOG_LEVEL_WARNING to the log file.
 //-----------------------------------------------------------------------------
 CX_LOGGING_API int LogWarningW(
-    const OLECHAR *message)		// message to log
+    const OLECHAR *message)             // message to log
 {
     return LogMessageW(LOG_LEVEL_WARNING, message);
 }
 //   Log a message at level LOG_LEVEL_ERROR to the log file.
 //-----------------------------------------------------------------------------
 CX_LOGGING_API int LogErrorW(
-    const OLECHAR *message)		// message to log
+    const OLECHAR *message)             // message to log
 {
     return LogMessageW(LOG_LEVEL_ERROR, message);
 }
 //   Log a message at level LOG_LEVEL_CRITICAL to the log file.
 //-----------------------------------------------------------------------------
 CX_LOGGING_API int LogCriticalW(
-    const OLECHAR *message)		// message to log
+    const OLECHAR *message)             // message to log
 {
     return LogMessageW(LOG_LEVEL_CRITICAL, message);
 }
 //   Log a message regardless of the current logging level to the log file.
 //-----------------------------------------------------------------------------
 CX_LOGGING_API int LogTraceW(
-    const OLECHAR *message)		// message to log
+    const OLECHAR *message)             // message to log
 {
     return LogMessageW(LOG_LEVEL_NONE, message);
 }
 //   Main routine for the DLL in Windows.
 //-----------------------------------------------------------------------------
 BOOL WINAPI DllMain(
-    HINSTANCE instance,			// handle to DLL
-    DWORD reason,			// reason for call
-    LPVOID reserved)			// reserved for future use
+    HINSTANCE instance,                 // handle to DLL
+    DWORD reason,                       // reason for call
+    LPVOID reserved)                    // reserved for future use
 {
     if (reason == DLL_PROCESS_ATTACH)
         INITIALIZE_LOCK(gLoggingStateLock);
 
 
 // define logging levels
-#define LOG_LEVEL_DEBUG			10
-#define LOG_LEVEL_INFO			20
-#define LOG_LEVEL_WARNING		30
-#define LOG_LEVEL_ERROR			40
-#define LOG_LEVEL_CRITICAL		50
-#define LOG_LEVEL_NONE			100
+#define LOG_LEVEL_DEBUG                 10
+#define LOG_LEVEL_INFO                  20
+#define LOG_LEVEL_WARNING               30
+#define LOG_LEVEL_ERROR                 40
+#define LOG_LEVEL_CRITICAL              50
+#define LOG_LEVEL_NONE                  100
 
 
 // define defaults
-#define DEFAULT_MAX_FILE_SIZE		1024 * 1024
-#define DEFAULT_PREFIX			"%t"
+#define DEFAULT_MAX_FILE_SIZE           1024 * 1024
+#define DEFAULT_PREFIX                  "%t"
 
 
 // declarations of methods exported
 CX_LOGGING_API int StartLogging(const char*, unsigned long, unsigned long,
-		unsigned long, const char *);
+                unsigned long, const char *);
 CX_LOGGING_API int StartLoggingForPythonThread(const char*, unsigned long,
-		unsigned long, unsigned long, const char *);
+                unsigned long, unsigned long, const char *);
 CX_LOGGING_API int StartLoggingStderr(unsigned long, const char *);
 CX_LOGGING_API int StartLoggingStdout(unsigned long, const char *);
 CX_LOGGING_API int StartLoggingFromEnvironment(void);
 
 #ifdef WIN32
 CX_LOGGING_API int StartLoggingW(const OLECHAR*, unsigned long, unsigned long,
-		unsigned long, const OLECHAR*);
+                unsigned long, const OLECHAR*);
 CX_LOGGING_API int LogMessageW(unsigned long, const OLECHAR*);
 CX_LOGGING_API int LogDebugW(const OLECHAR*);
 CX_LOGGING_API int LogInfoW(const OLECHAR*);
+python /u01/subversion/python/trunk/Doc/tools/mkhowto \
+	--html --dir ../html cx_Logging.tex 
+rm -rf ../html/WARNINGS
+rm -f ../html/index.dat
+rm -rf ../html/*.pl
+

doc/cx_Logging.tex

+\documentclass{manual}
+\usepackage[T1]{fontenc}
+
+\title{cx\_Logging}
+
+\author{Anthony Tuininga}
+\authoraddress{
+        \strong{Computronix}\\
+        Email: \email{anthony.tuininga@gmail.com}
+}
+
+\date{\today}                   % date of release
+\release{HEAD}                  % software release
+\setreleaseinfo{}		% empty for final release
+\setshortversion{HEAD}          % major.minor only for software
+
+\begin{document}
+
+\maketitle
+
+\ifhtml
+\chapter*{Front Matter\label{front}}
+\fi
+
+Copyright \copyright{} 2004-2006 Computronix.
+All rights reserved.
+
+See the end of this document for complete license and permissions
+information.
+
+\begin{abstract}
+
+\noindent
+cx\_Logging is a Python extension module that behaves similarly to the logging
+module found in the standard Python library but has a C interface.
+
+\end{abstract}
+
+\tableofcontents
+
+\chapter{Module Interface\label{module}}
+
+\section{Starting Logging \label{pyStartLogging}}
+
+\begin{funcdesc}{StartLogging}{\var{fileName}, \var{level},
+    \optional{\var{maxFiles}, \var{maxFileSize}, \var{prefix}}}
+  Start logging to the specified file at the given level.
+\end{funcdesc}
+
+\begin{funcdesc}{StartLoggingForThread}{\var{fileName}, \var{level},
+    \optional{\var{maxFiles}, \var{maxFileSize}, \var{prefix}}}
+  Start logging to the specified file at the given level but only for the
+  current Python thread.
+\end{funcdesc}
+
+\begin{funcdesc}{StartLoggingStderr}{\var{level}, \optional{\var{prefix}}}
+  Start logging to stderr at the specified level.
+\end{funcdesc}
+
+\begin{funcdesc}{StartLoggingStdout}{\var{level}, \optional{\var{prefix}}}
+  Start logging to stdout at the specified level.
+\end{funcdesc}
+
+
+\section{Stopping Logging \label{pyStopLogging}}
+
+\begin{funcdesc}{StopLogging}{}
+  Stop logging.
+\end{funcdesc}
+
+\begin{funcdesc}{StopLoggingForThread}{}
+  Stop logging on the given Python thread.
+\end{funcdesc}
+
+
+\section{Logging Messages \label{pyLogMessages}}
+
+\begin{funcdesc}{Critical}{\var{format}, \var{*args}}
+  Log a message at the CRITICAL level. The format and arguments are the
+  standard Python format.
+\end{funcdesc}
+
+\begin{funcdesc}{Debug}{\var{format}, \var{*args}}
+  Log a message at the DEBUG level. The format and arguments are the standard
+  Python format.
+\end{funcdesc}
+
+\begin{funcdesc}{Error}{\var{format}, \var{*args}}
+  Log a message at the ERROR level. The format and arguments are the standard
+  Python format.
+\end{funcdesc}
+
+\begin{funcdesc}{Info}{\var{format}, \var{*args}}
+  Log a message at the INFO level. The format and arguments are the standard
+  Python format.
+\end{funcdesc}
+
+\begin{funcdesc}{Log}{\var{level}, \var{format}, \var{*args}}
+  Log a message at the specified level. The format and arguments are the
+  standard Python format.
+\end{funcdesc}
+
+\begin{funcdesc}{Trace}{\var{format}, \var{*args}}
+  Log a message regardless of the current level. The format and arguments are
+  the standard Python format.
+\end{funcdesc}
+
+\begin{funcdesc}{Warning}{\var{format}, \var{*args}}
+  Log a message at the WARNING level. The format and arguments are the standard
+  Python format.
+\end{funcdesc}
+
+
+\section{Logging Exceptions \label{pyLogExceptions}}
+
+\begin{funcdesc}{LogException}{\var{value},
+    \optional{\var{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).
+\end{funcdesc}
+
+
+\section{Logging State \label{pyLoggingState}}
+
+\begin{funcdesc}{GetLoggingFile}{}
+  Return the file object to which logging is currently taking place.
+\end{funcdesc}
+
+\begin{funcdesc}{GetLoggingFileName}{}
+  Return the name of the file to which logging is currently taking place.
+\end{funcdesc}
+
+\begin{funcdesc}{GetLoggingLevel}{}
+  Return the current logging level.
+\end{funcdesc}
+
+\begin{funcdesc}{GetLoggingState}{}
+  Return the current logging state.
+\end{funcdesc}
+
+\begin{funcdesc}{SetLoggingLevel}{\var{level}}
+  Set the current logging level.
+\end{funcdesc}
+
+\begin{funcdesc}{SetLoggingState}{\var{state}}
+  Set the current logging state.
+\end{funcdesc}
+
+\section{Constants}
+
+\begin{datadesc}{buildtime}
+  The date and time when the module was built.
+\end{datadesc}
+
+\begin{datadesc}{CRITICAL}
+  The level at which critical errors are logged.
+\end{datadesc}
+
+\begin{datadesc}{DEBUG}
+  The level at which debugging messages are logged.
+\end{datadesc}
+
+\begin{datadesc}{ENV_NAME_FILE_NAME}
+  The environment variable name used for defining the file to which messages
+  are to be logged.
+\end{datadesc}
+
+\begin{datadesc}{ENV_NAME_LEVEL}
+  The environment variable name used for defining the level at which messages
+  are to be logged.
+\end{datadesc}
+
+\begin{datadesc}{ENV_NAME_MAX_FILES}
+  The environment variable name used for defining the maximum number of files
+  to use in the rotating logging scheme.
+\end{datadesc}
+
+\begin{datadesc}{ENV_NAME_MAX_FILE_SIZE}
+  The environment variable name used for defining the maximum size of files
+  before the files are rotated.
+\end{datadesc}
+
+\begin{datadesc}{ENV_NAME_PREFIX}
+  The environment variable name used for defining the prefix to use for all
+  messages.
+\end{datadesc}
+
+\begin{datadesc}{ERROR}
+  The level at which errors are logged.
+\end{datadesc}
+
+\begin{datadesc}{INFO}
+  The level at which information messages are logged.
+\end{datadesc}
+
+\begin{datadesc}{NONE}
+  The level at which no messages are logged.
+\end{datadesc}
+
+\begin{datadesc}{version}
+  The version of the module.
+\end{datadesc}
+
+\begin{datadesc}{WARNING}
+  The level at which warning messages are logged.
+\end{datadesc}
+
+\chapter{C Interface\label{cinterface}}
+
+All methods return -1 for an error or 0 for success unless otherwise stated.
+
+\section{Starting Logging \label{cStartLogging}}
+
+\begin{cfuncdesc}{int}{StartLogging}{const char *filename, unsigned long level,
+        unsigned long maxfiles, unsigned long maxfilesize, const char *prefix}
+  Start logging to the specified file at the given level.
+\end{cfuncdesc}
+
+\begin{cfuncdesc}{int}{StartLoggingFromEnvironment}{}
+  Start logging by reading the environment variables "CX_LOGGING_FILE_NAME",
+  "CX_LOGGING_LEVEL", "CX_LOGGING_MAX_FILES", "CX_LOGGING_MAX_FILE_SIZE",
+  "CX_LOGGING_PREFIX" to determine the parameters to the StartLogging method.
+\end{cfuncdesc}
+
+\begin{cfuncdesc}{int}{StartLoggingForPythonThread}{const char *filename,
+        unsigned long level, unsigned long maxfiles, unsigned long maxfilesize,
+        const char *prefix}
+  Start logging to the specified file at the given level but only for the
+  currently active Python thread.
+\end{cfuncdesc}
+
+\begin{cfuncdesc}{int}{StartLoggingStderr}{unsigned long level,
+        const char *prefix}
+  Start logging to stderr at the given level.
+\end{cfuncdesc}
+
+\begin{cfuncdesc}{int}{StartLoggingStdout}{unsigned long level,
+        const char *prefix}
+  Start logging to stdout at the given level.
+\end{cfuncdesc}
+
+
+\section{Stopping Logging\label{cStopLogging}}
+
+\begin{cfuncdesc}{void}{StopLogging}{}
+  Stop logging.
+\end{cfuncdesc}
+
+\begin{cfuncdesc}{void}{StopLoggingForPythonThread}{}
+  Stop logging in the current Python thread.
+\end{cfuncdesc}
+
+
+\section{Logging Messages\label{cLoggingMessages}}
+
+\begin{cfuncdesc}{int}{LogCritical}{const char *message}
+  Log message at CRITICAL level.
+\end{cfuncdesc}
+
+\begin{cfuncdesc}{int}{LogDebug}{const char *message}
+  Log message at DEBUG level.
+\end{cfuncdesc}
+
+\begin{cfuncdesc}{int}{LogError}{const char *message}
+  Log message at ERROR level.
+\end{cfuncdesc}
+
+\begin{cfuncdesc}{int}{LogInfo}{const char *message}
+  Log message at INFORMATION level.
+\end{cfuncdesc}
+
+\begin{cfuncdesc}{int}{LogMessage}{unsigned long level, const char *message}
+  Log a message at the specified level.
+\end{cfuncdesc}
+
+\begin{cfuncdesc}{int}{LogMessageV}{unsigned long level, const char *format,
+        ...}
+  Log a message at the specified level using the standard C printf format with
+  arguments.
+\end{cfuncdesc}
+
+\begin{cfuncdesc}{int}{LogMessageVaList}{unsigned long level,
+        const char *format, va_list args}
+  Log a message at the specified level using the standard C printf format with
+  arguments already encoded in a va_list.
+\end{cfuncdesc}
+
+\begin{cfuncdesc}{int}{LogMessageForPythonV}{unsigned long level,
+        const char *format, ...}
+  Log a message at the specified level in the logging file defined for the
+  current Python thread using the standard C printf format with arguments.
+\end{cfuncdesc}
+
+\begin{cfuncdesc}{int}{LogMessageForPythonVaList}{unsigned long level,
+        const char *format, ...}
+  Log a message at the specified level in the logging file defined for the
+  current Python thread using the standard C printf format with arguments
+  already encoded in a va_list.
+\end{cfuncdesc}
+
+\begin{cfuncdesc}{int}{LogTrace}{const char *message}
+  Log message regardless of what level is currently being logged. This is
+  primarily of use for logging tracing messages.
+\end{cfuncdesc}
+
+\begin{cfuncdesc}{int}{LogWarning}{const char *message}
+  Log message at WARNING level.
+\end{cfuncdesc}
+
+
+\section{Logging Exceptions\label{cLoggingExceptions}}
+
+\begin{cfuncdesc}{int}{LogConfiguredException}{PyObject *errorobj}
+  Log the contents of the error object. This method expects attributes named
+  "message", "templateId", "arguments", "traaceback", "details" and "logLevel".
+  If the "logLevel" attribute is missing logging is done at the ERROR level.
+  If any of the other attributes are missing or of the wrong type that fact is
+  logged and processing continues. This function returns -1 at all times as a
+  convenience to the caller.
+\end{cfuncdesc}
+
+\begin{cfuncdesc}{int}{LogPythonException}{const char *message}
+  Log the current Python exception with the given message as the first message
+  that is written to the log. The exception is logged with traceback if the
+  traceback module is available. This function returns -1 at all times as a
+  convenience to the caller.
+\end{cfuncdesc}
+
+\begin{cfuncdesc}{int}{LogPythonExceptionWithTraceback}{const char *message,
+        PyObject *type, PyObject *value, PyObject *traceback}
+  Log the specified Python exception with the given message as the first
+  message that is written to the log. The exception is logged with traceback if
+  the traceback module is available. This function returns -1 at all times as a
+  convenience to the caller.
+\end{cfuncdesc}
+
+
+\section{Logging State\label{cLoggingState}}
+
+\begin{cfuncdesc}{unsigned long}{GetLoggingLevel}{}
+  Return the current logging level.
+\end{cfuncdesc}
+
+\begin{cfuncdesc}{udt_LoggingState*}{GetLoggingState}{}
+  Return the logging state for the current Python thread.
+\end{cfuncdesc}
+
+\begin{cfuncdesc}{int}{IsLoggingStarted}{}
+  Return 1 if logging has been started and 0 otherwise.
+\end{cfuncdesc}
+
+\begin{cfuncdesc}{int}{SetLoggingLevel}{unsigned long newlevel}
+  Set the current logging level.
+\end{cfuncdesc}
+
+\begin{cfuncdesc}{int}{SetLoggingState}{udt_LoggingState *state}
+  Set the logging state for the current Python thread.
+\end{cfuncdesc}
+
+\input{license}
+
+\end{document}
+
+\chapter{License}
+
+\centerline{\strong{LICENSE AGREEMENT FOR CX\_LOGGING \version}}
+
+Copyright \copyright{} 2004-2007, Computronix (Canada) Ltd., Edmonton, Alberta, Canada.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+\begin{enumerate}
+\item
+    Redistributions of source code must retain the above copyright notice,
+    this list of conditions, and the disclaimer that follows.
+
+\item
+    Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions, and the following disclaimer in the
+    documentation and/or other materials provided with the distribution.
+
+\item
+    Neither the name of Computronix nor the names of its contributors may
+    be used to endorse or promote products derived from this software
+    without specific prior written permission.
+\end{enumerate}
+
+DISCLAIMER:
+THIS SOFTWARE IS PROVIDED BY COMPUTRONIX AND CONTRIBUTORS *AS IS*
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COMPUTRONIX
+OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+Computronix (R) is a registered trademark of Computronix (Canada) Ltd.
+
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.