void TimeStamp::changeTimezone( TimeZone tz ) { if ( m_timezone == tz_local ) { m_timezone = Sys::Time::getLocalTimeZone(); if (tz == tz_local ) // no shift... return; } if ( tz == tz_local ) tz = Sys::Time::getLocalTimeZone(); // no shift if ( tz == m_timezone ) return; // get the relative total shift. int16 currentHour=0, currentMin=0, newHour=0, newMin=0; getTZDisplacement( tz, newHour, newMin ); getTZDisplacement( m_timezone, currentHour, currentMin ); m_hour -= currentHour; m_hour += newHour; m_minute -= currentMin; m_minute += newMin; rollOver( false ); m_timezone = tz; }
void RollingFileAppender::append(const LoggingEvent &rEvent) { // Q_ASSERT_X(, "RollingFileAppender::append()", "Lock must be held by caller") FileAppender::append(rEvent); if (writer()->device()->size() > this->mMaximumFileSize) rollOver(); }
void DailyRollingFileAppender::append(const LoggingEvent &rEvent) { // Q_ASSERT_X(, "DailyRollingFileAppender::append()", "Lock must be held by caller") if (QDateTime::currentDateTime() >= mRollOverTime) rollOver(); FileAppender::append(rEvent); }
void RollingFileAppender::append(const QDateTime& timeStamp, Logger::LogLevel logLevel, const char* file, int line, const char* function, const QString& category, const QString& message) { if (!m_rollOverTime.isNull() && QDateTime::currentDateTime() > m_rollOverTime) rollOver(); FileAppender::append(timeStamp, logLevel, file, line, function, category, message); }
void TimeStamp::add( int32 days, int32 hours, int32 mins, int32 secs, int32 msecs ) { m_day = days + dayOfYear(); m_hour += hours; m_minute += mins; m_second += secs; m_msec += msecs; rollOver(); }
void RollingFileAppender::_append(const LoggingEvent& event) { FileAppender::_append(event); off_t offset = ::lseek(_fd, 0, SEEK_END); if (offset < 0) { // XXX we got an error, ignore for now } else { if(static_cast<size_t>(offset) >= _maxFileSize) { rollOver(); } } }
void DailyRollingFileAppender::activateOptions() { QMutexLocker locker(&mObjectGuard); computeFrequency(); if (!mActiveDatePattern.isEmpty()) { rollOver(); FileAppender::activateOptions(); } }
void SyslogLogger::handleRequest(Request *request, HandlerContext *handlerContext) { request->setContentType("text/plain"); const std::string &action = request->getArg("action"); if ("setlevel" == action) { const std::string &l = request->getArg("level"); setLevel(stringToLevel(l)); RequestStream(request) << "level " << l << "successfully set" << std::endl; } else if ("rollover" == action) { rollOver(); RequestStream(request) << "rollover successful" << std::endl; } else { RequestStream(request) << "bad action" << std::endl; } }
void LogConfig::outputToFile(LogLevel ll, char const *data, size_t size) { grab aholdof(logFileLock_); if (ll <= g_stderrLogLevel_) { cerrLog_->output(data, size); } ++logN_; if (!(logN_ & 1023)) { rollOver(); } if (msg_is_duplicate(data, size)) { ++sameCount_; return; } remember_for_duplicate(data, size); getOrMakeLogFile()->output(data, size); }
void DailyRollingFileAppender::_append(const log4cpp::LoggingEvent &event) { struct tm now; time_t t = time(NULL); #ifndef WIN32 // only available on Win32 bool timeok = localtime_r(&t, &now) != NULL; #else bool timeok = localtime_s(&now, &t) == 0; #endif if (timeok) { if ((now.tm_mday != _logsTime.tm_mday) || (now.tm_mon != _logsTime.tm_mon) || (now.tm_year != _logsTime.tm_year)) { rollOver(); _logsTime = now; } } log4cpp::FileAppender::_append(event); }
void TimeStamp::add( const TimeStamp &ts ) { m_day += ts.m_day; m_hour += ts.m_hour; m_minute += ts.m_minute; m_second += ts.m_second; m_msec += ts.m_msec; if ( m_timezone != ts.m_timezone && m_timezone != tz_NONE && ts.m_timezone != tz_NONE ) { int16 hours=0, mins=0, ts_hours=0, ts_mins=0; ts.getTZDisplacement( ts_hours, ts_mins ); getTZDisplacement( hours, mins ); m_hour += hours - ts_hours; m_minute += hours - ts_mins; } rollOver(); if ( m_timezone == tz_NONE ) m_timezone = ts.m_timezone; }