XN_C_API XnStatus xnLogInitFromINIFile(const XnChar* cpINIFileName, const XnChar* cpSectionName) { XnStatus nRetVal = XN_STATUS_OK; XnUInt32 nTemp; xnLogReadMasksFromINI(cpINIFileName, cpSectionName, "LogMasks", &g_xnLoggerData.m_nLogFilteringType, &g_xnLoggerData.m_LogMasks); xnLogReadMasksFromINI(cpINIFileName, cpSectionName, "DumpMasks", &g_xnLoggerData.m_nDumpFilteringType, &g_xnLoggerData.m_DumpMasks); g_xnLoggerData.m_nFilterSeverity = XN_LOG_ERROR; nRetVal = xnOSReadIntFromINI(cpINIFileName, cpSectionName, "LogLevel", &nTemp); if (nRetVal == XN_STATUS_OK) g_xnLoggerData.m_nFilterSeverity = (XnLogSeverity)nTemp; g_xnLoggerData.m_bWriteToConsole = FALSE; nRetVal = xnOSReadIntFromINI(cpINIFileName, cpSectionName, "LogWriteToConsole", &nTemp); if (nRetVal == XN_STATUS_OK) g_xnLoggerData.m_bWriteToConsole = nTemp; g_xnLoggerData.m_bWriteToFile = TRUE; nRetVal = xnOSReadIntFromINI(cpINIFileName, cpSectionName, "LogWriteToFile", &nTemp); if (nRetVal == XN_STATUS_OK) g_xnLoggerData.m_bWriteToFile = nTemp; g_xnLoggerData.m_bWriteLineInfo = TRUE; nRetVal = xnOSReadIntFromINI(cpINIFileName, cpSectionName, "LogWriteLineInfo", &nTemp); if (nRetVal == XN_STATUS_OK) g_xnLoggerData.m_bWriteLineInfo = nTemp; return xnLogInitSystem(); }
XN_C_API XnStatus xnLogInitFromINIFile(const XnChar* cpINIFileName, const XnChar* cpSectionName) { XnStatus nRetVal = XN_STATUS_OK; XnInt32 nTemp; // read filters xnLogReadMasksFromINI(cpINIFileName, cpSectionName, "LogMasks", xnLogBCSetMaskState); xnLogReadMasksFromINI(cpINIFileName, cpSectionName, "DumpMasks", xnDumpSetMaskState); //Test if log redirection is needed XnChar strLogPath[XN_FILE_MAX_PATH] = {0}; nRetVal = xnOSReadStringFromINI(cpINIFileName, cpSectionName, "LogPath", strLogPath, XN_FILE_MAX_PATH); if (nRetVal == XN_STATUS_OK) { nRetVal = xnLogSetOutputFolder(strLogPath); XN_IS_STATUS_OK(nRetVal); } nRetVal = xnOSReadIntFromINI(cpINIFileName, cpSectionName, "Verbosity", &nTemp); if (nRetVal == XN_STATUS_OK) { nRetVal = xnLogSetMaskMinSeverity(XN_LOG_MASK_ALL, (XnLogSeverity)nTemp); XN_IS_STATUS_OK(nRetVal); } // configure writers nRetVal = xnOSReadIntFromINI(cpINIFileName, cpSectionName, "LogToConsole", &nTemp); if (nRetVal == XN_STATUS_OK) { nRetVal = xnLogSetConsoleOutput(nTemp); XN_IS_STATUS_OK(nRetVal); } nRetVal = xnOSReadIntFromINI(cpINIFileName, cpSectionName, "LogToFile", &nTemp); if (nRetVal == XN_STATUS_OK) { nRetVal = xnLogSetFileOutput(nTemp); XN_IS_STATUS_OK(nRetVal); } #if XN_PLATFORM == XN_PLATFORM_ANDROID_ARM nRetVal = xnOSReadIntFromINI(cpINIFileName, cpSectionName, "LogToAndroidLog", &nTemp); if (nRetVal == XN_STATUS_OK) { nRetVal = xnLogSetAndroidOutput(nTemp); XN_IS_STATUS_OK(nRetVal); } #endif nRetVal = xnOSReadIntFromINI(cpINIFileName, cpSectionName, "LogLineInfo", &nTemp); if (nRetVal == XN_STATUS_OK) { nRetVal = xnLogSetLineInfo(nTemp); XN_IS_STATUS_OK(nRetVal); } return XN_STATUS_OK; }
XN_C_API XnStatus xnLogInitFromINIFile(const XnChar* cpINIFileName, const XnChar* cpSectionName) { XnStatus nRetVal = XN_STATUS_OK; XnUInt32 nTemp; nRetVal = xnLogInitSystem(); XN_IS_STATUS_OK(nRetVal); // read filters xnLogReadMasksFromINI(cpINIFileName, cpSectionName, "LogMasks", xnLogSetMaskState); xnLogReadMasksFromINI(cpINIFileName, cpSectionName, "DumpMasks", xnDumpSetMaskState); g_logData.m_nFilterSeverity = XN_LOG_ERROR; nRetVal = xnOSReadIntFromINI(cpINIFileName, cpSectionName, "LogLevel", &nTemp); if (nRetVal == XN_STATUS_OK) { nRetVal = xnLogSetSeverityFilter((XnLogSeverity)nTemp); XN_IS_STATUS_OK(nRetVal); } // configure writers nRetVal = xnOSReadIntFromINI(cpINIFileName, cpSectionName, "LogWriteToConsole", &nTemp); if (nRetVal == XN_STATUS_OK) { nRetVal = xnLogSetConsoleOutput(nTemp); XN_IS_STATUS_OK(nRetVal); } nRetVal = xnOSReadIntFromINI(cpINIFileName, cpSectionName, "LogWriteToFile", &nTemp); if (nRetVal == XN_STATUS_OK) { nRetVal = xnLogSetFileOutput(nTemp); XN_IS_STATUS_OK(nRetVal); } nRetVal = xnOSReadIntFromINI(cpINIFileName, cpSectionName, "LogWriteLineInfo", &nTemp); if (nRetVal == XN_STATUS_OK) { nRetVal = xnLogSetLineInfo(nTemp); XN_IS_STATUS_OK(nRetVal); } return XN_STATUS_OK; }