Ejemplo n.º 1
0
  virtual void append(const log4cxx::spi::LoggingEventPtr& event, log4cxx::helpers::Pool& pool)
  {
    Info info;
    info.level_ = event->getLevel();
    info.message_ = event->getMessage();
    info.logger_name_ = event->getLoggerName();

    info_.push_back( info );
  }
Ejemplo n.º 2
0
  virtual void append(const log4cxx::spi::LoggingEventPtr& event, log4cxx::helpers::Pool& pool)
  {
    (void)pool;
    levels::Level level;
    if (event->getLevel() == log4cxx::Level::getFatal())
    {
      level = levels::Fatal;
    }
    else if (event->getLevel() == log4cxx::Level::getError())
    {
      level = levels::Error;
    }
    else if (event->getLevel() == log4cxx::Level::getWarn())
    {
      level = levels::Warn;
    }
    else if (event->getLevel() == log4cxx::Level::getInfo())
    {
      level = levels::Info;
    }
    else if (event->getLevel() == log4cxx::Level::getDebug())
    {
      level = levels::Debug;
    }
    else
    {
      return;
    }

    #ifdef _MSC_VER
      LOG4CXX_ENCODE_CHAR(tmpstr, event->getMessage());  // has to handle LogString with wchar types.
      std::string msg = tmpstr  // tmpstr gets instantiated inside the LOG4CXX_ENCODE_CHAR macro
    #else
      std::string msg = event->getMessage();
    #endif

    const log4cxx::spi::LocationInfo& info = event->getLocationInformation();
    appender_->log(level, msg.c_str(), info.getFileName(), info.getMethodName().c_str(), info.getLineNumber());
  }