void mainBoardCommonMainInit(RobotConfig* robotConfig) { // LOG the BoardName appendStringCRLF(getAlwaysOutputStreamLogger(), getBoardName()); // Increase the Log Level to DEBUG if the config bit are set Logger* logger = getLoggerInstance(); if (isConfigSet(robotConfig, CONFIG_DEBUG)) { logger->globalLogLevel = LOG_LEVEL_DEBUG; } appendString(getInfoOutputStreamLogger(), "GLOBAL LEVEL : "); appendLevelAsString(getInfoOutputStreamLogger(), logger->globalLogLevel); println(getInfoOutputStreamLogger()); }
ostream& LTKLoggerUtil::logMessage(LTKLogger::EDebugLevel logLevel, string inStr, int lineNumber) { #if 0 /* Android port : commenting the load of shared objects and also mapping of functions * as there is only one shared object. */ m_ptrOSUtil = LTKOSUtilFactory::getInstance(); if (m_libHandleLogger == NULL) { m_libHandleLogger = m_ptrOSUtil->getLibraryHandle(LOGGER_MODULE_STR); if (m_libHandleLogger == NULL) { delete m_ptrOSUtil; return m_emptyStream; } } // get function addresses if ( module_startLogger == NULL || module_logMessage == NULL ) { int returnVal = getAddressLoggerFunctions(); if(returnVal != SUCCESS) { delete m_ptrOSUtil; return m_emptyStream; } } delete m_ptrOSUtil; return module_logMessage(logLevel, inStr, lineNumber); #endif /* Android port : get an instance of logger instance and invoke overloaded operator() * from LTKLogger.cpp. As logger is implemented as a singleton class, only one instance * is returned irrespective of how many times getLoggerInstance() is called. */ LTKLoggerInterface* logger = getLoggerInstance(); return (*logger)(logLevel, inStr, lineNumber); }
/***************************************************************************** * AUTHOR : Nidhi Sharma * DATE : * NAME : getAddressLoggerFunctions * DESCRIPTION : * ARGUMENTS : * RETURNS : * NOTES : * CHANGE HISTROY * Author Date Description of change *****************************************************************************/ int LTKLoggerUtil::configureLogger(const string& logFile, LTKLogger::EDebugLevel logLevel) { #if 0 /* Android port: commenting the load of shared objects and mapping of functions * as there is only one shared object. */ void* functionHandle = NULL; int returnVal = SUCCESS; FN_PTR_SETLOGFILENAME module_setLogFileName = NULL; FN_PTR_SETLOGLEVEL module_setLogLevel = NULL; if (m_libHandleLogger == NULL ) { LTKReturnError(ELOGGER_LIBRARY_NOT_LOADED); } m_ptrOSUtil = LTKOSUtilFactory::getInstance(); if ( logFile.length() != 0 ) { returnVal = m_ptrOSUtil->getFunctionAddress(m_libHandleLogger, "setLoggerFileName", &functionHandle); if(returnVal != SUCCESS) { return returnVal; } module_setLogFileName = (FN_PTR_SETLOGFILENAME)functionHandle; functionHandle = NULL; module_setLogFileName(logFile); } else { LTKReturnError(EINVALID_LOG_FILENAME); } returnVal = m_ptrOSUtil->getFunctionAddress(m_libHandleLogger, "setLoggerLevel", &functionHandle); if(returnVal != SUCCESS) { LTKReturnError(returnVal); } module_setLogLevel = (FN_PTR_SETLOGLEVEL)functionHandle; functionHandle = NULL; module_setLogLevel(logLevel); delete m_ptrOSUtil; #endif /* Android port : get an instance of logger. */ LTKLoggerInterface* logger = getLoggerInstance(); logger->setLogLevel(logLevel); return SUCCESS; }