XN_C_API void xnLogWriteBinaryData(const XnChar* csLogMask, XnLogSeverity nSeverity, const XnChar* csFile, XnUInt32 nLine, XnUChar* pBinData, XnUInt32 nDataSize, const XnChar* csFormat, ...) { if (!xnLogIsEnabled(csLogMask, nSeverity)) return; // first write preceding message: va_list args; va_start(args, csFormat); xnLogWriteImplV(csLogMask, nSeverity, csFile, nLine, csFormat, args); va_end(args); // now write binary data (in lines of 16 bytes) XnChar csLine[256]; XnUInt32 pos = 0; for (XnUInt32 i = 0; i < nDataSize; ++i) { if ((i % 16) == 0) // first byte in line { // start a new line pos = sprintf(csLine, "%6u: ", i); } pos += sprintf(csLine + pos, "%02x ", pBinData[i]); if ((i % 16) == 15 || (i == nDataSize-1)) // last byte in line { xnLogWriteImpl(csLogMask, nSeverity, csFile, nLine, "%s", csLine); } } }
void xnLogWriteImpl(const XnChar* csLogMask, XnLogSeverity nSeverity, const XnChar* csFile, XnUInt32 nLine, const XnChar* csFormat, ...) { va_list args; va_start(args, csFormat); xnLogWriteImplV(csLogMask, nSeverity, csFile, nLine, csFormat, args); va_end(args); }
XN_C_API void xnLogWrite(const XnChar* csLogMask, XnLogSeverity nSeverity, const XnChar* csFile, XnUInt32 nLine, const XnChar* csFormat, ...) { if (!xnLogIsEnabled(csLogMask, nSeverity)) return; // write message va_list args; va_start(args, csFormat); xnLogWriteImplV(csLogMask, nSeverity, csFile, nLine, csFormat, args); va_end(args); }
XN_C_API void XN_C_DECL xnLoggerWrite(XnLogger* pLogger, XnLogSeverity nSeverity, const XnChar* csFile, XnUInt32 nLine, const XnChar* csFormat, ...) { if (!xnLoggerIsEnabled(pLogger, nSeverity)) return; const XnChar* strMask = (const XnChar*)pLogger->pInternal; // write message va_list args; va_start(args, csFormat); xnLogWriteImplV(strMask, nSeverity, csFile, nLine, csFormat, args); va_end(args); }