virtual void log(const std::string& file, int line, LogLevel level, const std::string& msg) { LocationInfo loc(file.c_str(), "", line); switch(level) { case INFO : m_logger->info(msg,loc); break; case DEBUG : m_logger->debug(msg,loc); break; case WARN : m_logger->warn(msg,loc); break; case ERROR : m_logger->error(msg,loc); break; } }
PANTHEIOS_CALL(int) pantheios_be_logEntry( void* /* feToken */ , void* /* beToken */ , int severity , char const* entry , size_t cchEntry ) { using namespace log4cxx; using namespace log4cxx::helpers; severity &= 0x07; LoggerPtr rootLogger = Logger::getRootLogger(); switch(severity) { case PANTHEIOS_SEV_EMERGENCY: case PANTHEIOS_SEV_ALERT: rootLogger->fatal(entry); break; case PANTHEIOS_SEV_CRITICAL: case PANTHEIOS_SEV_ERROR: rootLogger->error(entry); break; case PANTHEIOS_SEV_WARNING: rootLogger->warn(entry); break; case PANTHEIOS_SEV_NOTICE: case PANTHEIOS_SEV_INFORMATIONAL: rootLogger->info(entry); break; case PANTHEIOS_SEV_DEBUG: rootLogger->debug(entry); break; } return cchEntry; }
/** * sets the root level for the logger. */ void Log4cxxLogger::setLevel(std::string esyslog, LoggerPtr rootLogger){ //LoggerPtr rootLogger = Logger::getRootLogger(); if (esyslog == "debug"){ rootLogger->setLevel(Level::DEBUG); } else if (esyslog == "info") rootLogger->setLevel(Level::INFO); else if (esyslog == "notice") rootLogger->setLevel(Level::INFO); else if (esyslog == "warning"){ rootLogger->setLevel(Level::WARN); } else if (esyslog == "err"){ rootLogger->setLevel(Level::ERROR); } else if (esyslog == "crit") rootLogger->setLevel(Level::FATAL); else if (esyslog == "alert") rootLogger->setLevel(Level::WARN); else if (esyslog == "emerg") rootLogger->setLevel(Level::FATAL); else { rootLogger->setLevel(Level::INFO); rootLogger->error("Unknown syslog level: " + esyslog); } }
void CLog4CXX::Error(const char *loginfo) { m_logger->error(loginfo); }