void gnkLog4cplus::GUIAppender::append(const log4cplus::spi::InternalLoggingEvent& e) { if (this->closed) { return; } MutexScopedLock lock( m_mutex ); log4cplus::tostringstream formattedLog; layout->formatAndAppend(formattedLog, e); m_Logs.push_back( GNC::GCS::Logging::LogEvent( e.getLoggerName().c_str(), llmCache.toString(e.getLogLevel()).c_str(), e.getTimestamp().getFormattedTime(datetimeFormat.c_str(), false).c_str(), e.getMessage().c_str(), formattedLog.str().c_str(), e.getThread().c_str() ) ); if (m_pLogger != NULL) { m_pLogger->Append(m_Logs.back()); } if (m_Logs.size() > MAX_LOG_BUFFER_SIZE) { m_Logs.pop_front(); } }
void LogServiceAppender::append(const log4cplus::spi::InternalLoggingEvent& event) { // custom layouts is not supported for log4cplus library std::string formatted_string(boost::lexical_cast<std::string>(event.getTimestamp().sec())); formatted_string += ' '; formatted_string += m_log_level_manager.toString(event.getLogLevel()); formatted_string += ' '; formatted_string += event.getLoggerName(); formatted_string += " - "; formatted_string += event.getMessage(); formatted_string += '\n'; addLogString(formatted_string); }