#include "XnOS.h"#include "XnLogTypes.h"#include "XnPlatform.h"#include "XnTypes.h"Go to the source code of this file.
Defines | |
| #define | XN_MASK_RETVAL_CHECKS "RetValChecks" |
| #define | XN_IS_STATUS_OK_LOG_ERROR(what, nRetVal) |
| #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__) |
Functions | |
| XN_C_API XnStatus XN_C_DECL | xnLogInitSystem () |
| XN_C_API XnStatus XN_C_DECL | xnLogInitFromINIFile (const XnChar *csINIFile, const XnChar *csSectionName) |
| XN_C_API XnStatus XN_C_DECL | xnLogInitFromXmlFile (const XnChar *strFileName) |
| XN_C_API XnStatus XN_C_DECL | xnLogRegisterLogWriter (const XnLogWriter *pWriter) |
| XN_C_API void XN_C_DECL | xnLogUnregisterLogWriter (const XnLogWriter *pWriter) |
| XN_C_API XnStatus XN_C_DECL | xnLogStartNewFile () |
| XN_C_API XnStatus XN_C_DECL | xnLogClose () |
| XN_C_API XnStatus XN_C_DECL | xnLogSetMaskState (const XnChar *csMask, XnBool bEnabled) |
| XN_C_API XnStatus XN_C_DECL | xnLogSetSeverityFilter (XnLogSeverity nMinSeverity) |
| XN_C_API XnStatus XN_C_DECL | xnLogSetConsoleOutput (XnBool bConsoleOutput) |
| XN_C_API XnStatus XN_C_DECL | xnLogSetFileOutput (XnBool bFileOutput) |
| XN_C_API XnStatus XN_C_DECL | xnLogSetLineInfo (XnBool bLineInfo) |
| XN_C_API XnStatus XN_C_DECL | xnLogSetOutputFolder (const XnChar *strOutputFolder) |
| XN_C_API XnBool XN_C_DECL | xnLogIsEnabled (const XnChar *csLogMask, XnLogSeverity nSeverity) |
| XN_C_API void XN_C_DECL | xnLogWrite (const XnChar *csLogMask, XnLogSeverity nSeverity, const XnChar *csFile, XnUInt32 nLine, const XnChar *csFormat,...) |
| XN_C_API void XN_C_DECL | xnLogWriteNoEntry (const XnChar *csLogMask, XnLogSeverity nSeverity, const XnChar *csFormat,...) |
| XN_C_API void XN_C_DECL | xnLogWriteBinaryData (const XnChar *csLogMask, XnLogSeverity nSeverity, const XnChar *csFile, XnUInt32 nLine, XnUChar *pBinData, XnUInt32 nDataSize, const XnChar *csFormat,...) |
| XN_C_API XnStatus XN_C_DECL | xnLogCreateFile (const XnChar *csFileName, XN_FILE_HANDLE *phFile) |
| #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_ERROR_RETURN | ( | nRetVal, | |||
| csLogMask, | |||||
| csFormat, | |||||
| ... | ) | XN_LOG_RETURN(nRetVal, XN_LOG_ERROR, csLogMask, csFormat, __VA_ARGS__) |
| #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_RETVAL_CHECKS "RetValChecks" |
| #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__) |
| XN_C_API XnStatus XN_C_DECL xnLogClose | ( | ) |
This function closes the log.
| XN_C_API XnStatus XN_C_DECL xnLogCreateFile | ( | const XnChar * | csFileName, | |
| XN_FILE_HANDLE * | phFile | |||
| ) |
Creates a file under the logs directory.
| csFileName | [in] Name of the file to create | |
| phFile | [out] The file handle. |
| XN_C_API XnStatus XN_C_DECL 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 XN_C_DECL 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 XN_C_DECL xnLogInitSystem | ( | ) |
This function initializes the log system.
| XN_C_API XnBool XN_C_DECL 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 XN_C_DECL xnLogRegisterLogWriter | ( | const XnLogWriter * | pWriter | ) |
Registers a new Log Writer to receive log entries.
| pWriter | [in] The writer to register |
| XN_C_API XnStatus XN_C_DECL 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 XN_C_DECL 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 XN_C_DECL 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 XN_C_DECL 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 XN_C_DECL xnLogSetOutputFolder | ( | const XnChar * | strOutputFolder | ) |
Configures the folder under which logs will be written.
| strOutputFolder | [in] Folder to write to |
| XN_C_API XnStatus XN_C_DECL xnLogSetSeverityFilter | ( | XnLogSeverity | nMinSeverity | ) |
Configures the minimum severity the log will output.
| nMinSeverity | [in] The minimum severity to output. |
| XN_C_API XnStatus XN_C_DECL xnLogStartNewFile | ( | ) |
This function closes current log file, and starts a new one
| XN_C_API void XN_C_DECL xnLogUnregisterLogWriter | ( | const XnLogWriter * | pWriter | ) |
Unregisters a Log Writer from receiving log entries.
| pWriter | [in] The writer to unregister |
| XN_C_API void XN_C_DECL 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 XN_C_DECL 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 XN_C_DECL 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. |
1.6.3