#include "XnOS.h"Go to the source code of this file.
Classes | |
| struct | XnDump |
Defines | |
| #define | XN_LOG_DIR_NAME "Log" |
| #define | XN_LOG_MASKS_STRING_LEN 600 |
| #define | XN_MASK_LOG "Log" |
| #define | XN_LOG_MASK_ALL "ALL" |
| #define | XN_MASK_RETVAL_CHECKS "RetValChecks" |
| #define | XN_IS_STATUS_OK_LOG_ERROR(what, nRetVal) |
| #define | xnDumpWriteString(dump, csFormat,...) |
| #define | xnLogVerbose(csLogMask, csFormat,...) xnLogWrite(csLogMask, XN_LOG_VERBOSE, __FILE__, __LINE__, csFormat, __VA_ARGS__) |
| #define | xnLogInfo(csLogMask, csFormat,...) xnLogWrite(csLogMask, XN_LOG_INFO, __FILE__, __LINE__, csFormat, __VA_ARGS__) |
| #define | xnLogWarning(csLogMask, csFormat,...) xnLogWrite(csLogMask, XN_LOG_WARNING, __FILE__, __LINE__, csFormat, __VA_ARGS__) |
| #define | xnLogError(csLogMask, csFormat,...) xnLogWrite(csLogMask, XN_LOG_ERROR, __FILE__, __LINE__, csFormat, __VA_ARGS__) |
| #define | XN_LOG_RETURN(nRetVal, nSeverity, csLogMask, csFormat,...) |
| #define | XN_LOG_WARNING_RETURN(nRetVal, csLogMask, csFormat,...) XN_LOG_RETURN(nRetVal, XN_LOG_WARNING, csLogMask, csFormat, __VA_ARGS__) |
| #define | XN_LOG_ERROR_RETURN(nRetVal, csLogMask, csFormat,...) XN_LOG_RETURN(nRetVal, XN_LOG_ERROR, csLogMask, csFormat, __VA_ARGS__) |
Typedefs | |
| typedef enum XnLogSeverity | XnLogSeverity |
| typedef struct XnDump | XnDump |
Enumerations | |
| enum | XnLogSeverity { XN_LOG_VERBOSE, XN_LOG_INFO, XN_LOG_WARNING, XN_LOG_ERROR } |
| enum | XnLogFilteringType { XN_LOG_WRITE_NONE, XN_LOG_WRITE_ALL, XN_LOG_WRITE_MASKS } |
Functions | |
| XN_C_API XnStatus | xnLogInitSystem () |
| XN_C_API XnStatus | xnLogInitFromINIFile (const XnChar *csINIFile, const XnChar *csSectionName) |
| XN_C_API XnStatus | xnLogInitFromXmlFile (const XnChar *strFileName) |
| XN_C_API XnStatus | xnLogStartNewFile () |
| XN_C_API XnStatus | xnLogClose () |
| XN_C_API XnStatus | xnLogSetMaskState (const XnChar *csMask, XnBool bEnabled) |
| XN_C_API XnStatus | xnDumpSetMaskState (const XnChar *csMask, XnBool bEnabled) |
| XN_C_API XnStatus | xnLogSetSeverityFilter (XnLogSeverity nMinSeverity) |
| XN_C_API XnStatus | xnLogSetConsoleOutput (XnBool bConsoleOutput) |
| XN_C_API XnStatus | xnLogSetFileOutput (XnBool bFileOutput) |
| XN_C_API XnStatus | xnLogSetLineInfo (XnBool bLineInfo) |
| XN_C_API XnStatus | xnLogSetOutputFolder (const XnChar *strOutputFolder) |
| XN_C_API XnBool | xnLogIsEnabled (const XnChar *csLogMask, XnLogSeverity nSeverity) |
| XN_C_API void | xnLogWrite (const XnChar *csLogMask, XnLogSeverity nSeverity, const XnChar *csFile, XnUInt32 nLine, const XnChar *csFormat,...) |
| XN_C_API void | xnLogWriteNoEntry (const XnChar *csLogMask, XnLogSeverity nSeverity, const XnChar *csFormat,...) |
| XN_C_API void | xnLogWriteBinaryData (const XnChar *csLogMask, XnLogSeverity nSeverity, const XnChar *csFile, XnUInt32 nLine, XnUChar *pBinData, XnUInt32 nDataSize, const XnChar *csFormat,...) |
| XN_C_API XnBool | xnLogIsDumpMaskEnabled (const XnChar *csDumpMask) |
| XN_C_API void | xnDumpInit (XnDump *pDump, const XnChar *csDumpMask, const XnChar *csHeader, const XnChar *csFileNameFormat,...) |
| XN_C_API void | xnDumpForceInit (XnDump *pDump, const XnChar *csHeader, const XnChar *csFileNameFormat,...) |
| XN_C_API void | xnDumpClose (XnDump *pDump) |
| XN_C_API void | xnDumpWriteBufferImpl (XnDump dump, const void *pBuffer, XnUInt32 nBufferSize) |
| void | xnDumpWriteBuffer (XnDump dump, const void *pBuffer, XnUInt32 nBufferSize) |
| XN_C_API void | xnDumpWriteStringImpl (XnDump dump, const XnChar *csFormat,...) |
| XN_C_API void | xnDumpFlush (XnDump dump) |
Variables | |
| const XnDump | XN_DUMP_CLOSED = { XN_INVALID_FILE_HANDLE } |
| #define XN_IS_STATUS_OK_LOG_ERROR | ( | what, | |||
| nRetVal | ) |
if (nRetVal != XN_STATUS_OK) \ { \ xnLogError(XN_MASK_RETVAL_CHECKS, "Failed to " what ": %s", xnGetStatusString(nRetVal)); \ XN_ASSERT(FALSE); \ return (nRetVal); \ }
Validates return value and writes log message with appropriate status string
| #define XN_LOG_DIR_NAME "Log" |
| #define XN_LOG_ERROR_RETURN | ( | nRetVal, | |||
| csLogMask, | |||||
| csFormat, | |||||
| ... | ) | XN_LOG_RETURN(nRetVal, XN_LOG_ERROR, csLogMask, csFormat, __VA_ARGS__) |
| #define XN_LOG_MASK_ALL "ALL" |
| #define XN_LOG_MASKS_STRING_LEN 600 |
| #define XN_LOG_RETURN | ( | nRetVal, | |||
| nSeverity, | |||||
| csLogMask, | |||||
| csFormat, | |||||
| ... | ) |
{ \
xnLogWrite(csLogMask, nSeverity, __FILE__, __LINE__, csFormat, __VA_ARGS__); \
return (nRetVal); \
}
| #define XN_LOG_WARNING_RETURN | ( | nRetVal, | |||
| csLogMask, | |||||
| csFormat, | |||||
| ... | ) | XN_LOG_RETURN(nRetVal, XN_LOG_WARNING, csLogMask, csFormat, __VA_ARGS__) |
| #define XN_MASK_LOG "Log" |
| #define XN_MASK_RETVAL_CHECKS "RetValChecks" |
| #define xnDumpWriteString | ( | dump, | |||
| csFormat, | |||||
| ... | ) |
if ((dump).hFile != XN_INVALID_FILE_HANDLE) { \ xnDumpWriteStringImpl((dump), csFormat, __VA_ARGS__); \ }
| #define xnLogError | ( | csLogMask, | |||
| csFormat, | |||||
| ... | ) | xnLogWrite(csLogMask, XN_LOG_ERROR, __FILE__, __LINE__, csFormat, __VA_ARGS__) |
| #define xnLogInfo | ( | csLogMask, | |||
| csFormat, | |||||
| ... | ) | xnLogWrite(csLogMask, XN_LOG_INFO, __FILE__, __LINE__, csFormat, __VA_ARGS__) |
| #define xnLogVerbose | ( | csLogMask, | |||
| csFormat, | |||||
| ... | ) | xnLogWrite(csLogMask, XN_LOG_VERBOSE, __FILE__, __LINE__, csFormat, __VA_ARGS__) |
| #define xnLogWarning | ( | csLogMask, | |||
| csFormat, | |||||
| ... | ) | xnLogWrite(csLogMask, XN_LOG_WARNING, __FILE__, __LINE__, csFormat, __VA_ARGS__) |
| typedef enum XnLogSeverity XnLogSeverity |
| enum XnLogFilteringType |
| enum XnLogSeverity |
| XN_C_API void xnDumpClose | ( | XnDump * | pDump | ) |
This function closes a dump file (use it once file is no longer needed). You can later use xnDumpWriteString and xnDumpWriteBuffer to write to this file.
| pDump | [in] A pointer to an XnDump struct returned from a call to xnDumpInit. |
| XN_C_API void xnDumpFlush | ( | XnDump | dump | ) |
Flushes a dump to the disk.
| dump | [in] The dump to flush. |
| XN_C_API void xnDumpForceInit | ( | XnDump * | pDump, | |
| const XnChar * | csHeader, | |||
| const XnChar * | csFileNameFormat, | |||
| ... | ||||
| ) |
This function creates an XnDump object through which dumps can be written. This dump will be created anyway, and does not depend on log configuration.
| pDump | [in] A handle to the dump. | |
| csHeader | [in] A header line to be written to the file. When this param is NULL, file will be opened as a binary file. When param is not NULL, the string will be written to the file once it is open. | |
| csFileNameFormat | [in] Format of the name to give the file. | |
| ... | [in] Arguments for the file name format string. |
| XN_C_API void xnDumpInit | ( | XnDump * | pDump, | |
| const XnChar * | csDumpMask, | |||
| const XnChar * | csHeader, | |||
| const XnChar * | csFileNameFormat, | |||
| ... | ||||
| ) |
This function creates an XnDump object through which dumps can be written. Dump will only be created if the mask is enabled.
| pDump | [in] A handle to the dump. | |
| csDumpMask | [in] The mask under which this dump should be written. | |
| csHeader | [in] A header line to be written to the file. When this param is NULL, file will be opened as a binary file. When param is not NULL, the string will be written to the file once it is open. | |
| csFileNameFormat | [in] Format of the name to give the file. | |
| ... | [in] Arguments for the file name format string. |
| XN_C_API XnStatus xnDumpSetMaskState | ( | const XnChar * | csMask, | |
| XnBool | bEnabled | |||
| ) |
Configures if a specific dump mask is enabled.
| csMask | [in] The mask to set. | |
| bEnabled | [in] TRUE to enable this mask, FALSE otherwise. |
| void xnDumpWriteBuffer | ( | XnDump | dump, | |
| const void * | pBuffer, | |||
| XnUInt32 | nBufferSize | |||
| ) | [inline] |
| XN_C_API void xnDumpWriteBufferImpl | ( | XnDump | dump, | |
| const void * | pBuffer, | |||
| XnUInt32 | nBufferSize | |||
| ) |
Writes a buffer to the dump.
| dump | [in] The dump to write to. | |
| pBuffer | [in] A pointer to the buffer to write. | |
| nBufferSize | [in] The number of bytes to write from the buffer. |
| XN_C_API void xnDumpWriteStringImpl | ( | XnDump | dump, | |
| const XnChar * | csFormat, | |||
| ... | ||||
| ) |
Writes a formatted string to the dump.
| dump | [in] The dump to write to. | |
| csFormat | [in] A format string. | |
| ... | [in] Arguments to the format string. |
| XN_C_API XnStatus xnLogClose | ( | ) |
This function closes the log.
| XN_C_API XnStatus xnLogInitFromINIFile | ( | const XnChar * | csINIFile, | |
| const XnChar * | csSectionName | |||
| ) |
This function initializes the log from an INI file.
| csINIFile | [in] The name of the INI file. | |
| csSectionName | [in] The name of the section to read values from. |
| XN_C_API XnStatus xnLogInitFromXmlFile | ( | const XnChar * | strFileName | ) |
This function initializes the log from an XML file.
| strFileName | [in] The name of the XML file. |
| XN_C_API XnStatus xnLogInitSystem | ( | ) |
This function initializes the log system.
| XN_C_API XnBool xnLogIsDumpMaskEnabled | ( | const XnChar * | csDumpMask | ) |
This function checks if a dump mask is enabled
| csDumpMask | [in] The mask that should be checked. |
| XN_C_API XnBool xnLogIsEnabled | ( | const XnChar * | csLogMask, | |
| XnLogSeverity | nSeverity | |||
| ) |
This function checks if a mask is enabled.
| csLogMask | [in] The mask that should be checked. | |
| nSeverity | [in] The severity. |
| XN_C_API XnStatus xnLogSetConsoleOutput | ( | XnBool | bConsoleOutput | ) |
Configures if log entries will be printed to console.
| bConsoleOutput | [in] TRUE to print log entries to console, FALSE otherwise. |
| XN_C_API XnStatus xnLogSetFileOutput | ( | XnBool | bFileOutput | ) |
Configures if log entries will be printed to a log file.
| bFileOutput | [in] TRUE to print log entries to the file, FALSE otherwise. |
| XN_C_API XnStatus xnLogSetLineInfo | ( | XnBool | bLineInfo | ) |
Configures if log entries will include the file and line that caused them.
| bLineInfo | [in] TRUE to print file and line, FALSE otherwise |
| XN_C_API XnStatus xnLogSetMaskState | ( | const XnChar * | csMask, | |
| XnBool | bEnabled | |||
| ) |
Configures if a specific log mask is enabled.
| csMask | [in] The mask to set. | |
| bEnabled | [in] TRUE to enable this mask, FALSE otherwise. |
| XN_C_API XnStatus xnLogSetOutputFolder | ( | const XnChar * | strOutputFolder | ) |
Configures the folder under which logs will be written.
| strOutputFolder | [in] Folder to write to |
| XN_C_API XnStatus xnLogSetSeverityFilter | ( | XnLogSeverity | nMinSeverity | ) |
Configures the minimum severity the log will output.
| nMinSeverity | [in] The minimum severity to output. |
| XN_C_API XnStatus xnLogStartNewFile | ( | ) |
This function closes current log file, and starts a new one
| XN_C_API void xnLogWrite | ( | const XnChar * | csLogMask, | |
| XnLogSeverity | nSeverity, | |||
| const XnChar * | csFile, | |||
| XnUInt32 | nLine, | |||
| const XnChar * | csFormat, | |||
| ... | ||||
| ) |
This function writes a formatted string to the log (only if the mask is turned on)
| csLogMask | [in] The mask under which this log should be written. | |
| nSeverity | [in] The severity of this log. | |
| csFile | [in] The name of the file writing this log entry. | |
| nLine | [in] The line number writing this log entry. | |
| csFormat | [in] A format string. |
| XN_C_API void xnLogWriteBinaryData | ( | const XnChar * | csLogMask, | |
| XnLogSeverity | nSeverity, | |||
| const XnChar * | csFile, | |||
| XnUInt32 | nLine, | |||
| XnUChar * | pBinData, | |||
| XnUInt32 | nDataSize, | |||
| const XnChar * | csFormat, | |||
| ... | ||||
| ) |
This function writes binary data as hex bytes (only if the mask is turned on).
| csLogMask | [in] The mask under which this log should be written. | |
| nSeverity | [in] The severity of this log. | |
| csFile | [in] The name of the file writing this log entry. | |
| nLine | [in] The line number writing this log entry. | |
| pBinData | [in] The binary data to be written. | |
| nDataSize | [in] The number of bytes in the binary data. | |
| csFormat | [in] A format string to precede the binary data. |
| XN_C_API void xnLogWriteNoEntry | ( | const XnChar * | csLogMask, | |
| XnLogSeverity | nSeverity, | |||
| const XnChar * | csFormat, | |||
| ... | ||||
| ) |
This function writes a formatted string to the log (only if the mask is turned on), but without marking the timestamp, and without placing the end-of-line marker. It is used for writing complex data to the log file.
| csLogMask | [in] The mask under which this log should be written. | |
| nSeverity | [in] The severity of this log. | |
| csFormat | [in] A format string. |
| const XnDump XN_DUMP_CLOSED = { XN_INVALID_FILE_HANDLE } |
1.6.3