DailyRollingFileAppender.hh 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * DailyRollingFileAppender.hh
  3. *
  4. * See the COPYING file for the terms of usage and distribution.
  5. */
  6. #ifndef _LOG4CPP_DAILYROLLINGFILEAPPENDER_HH
  7. #define _LOG4CPP_DAILYROLLINGFILEAPPENDER_HH
  8. #include <log4cpp/Portability.hh>
  9. #include <log4cpp/FileAppender.hh>
  10. #include <string>
  11. #include <stdarg.h>
  12. namespace log4cpp {
  13. /**
  14. DailyRollingFileAppender is a FileAppender that rolls over the logfile once
  15. the next day starts.
  16. @since 1.1.2
  17. **/
  18. class LOG4CPP_EXPORT DailyRollingFileAppender : public FileAppender {
  19. public:
  20. DailyRollingFileAppender(const std::string& name,
  21. const std::string& fileName,
  22. unsigned int maxDaysToKeep = maxDaysToKeepDefault,
  23. bool append = true,
  24. mode_t mode = 00644);
  25. virtual void setMaxDaysToKeep(unsigned int maxDaysToKeep);
  26. virtual unsigned int getMaxDaysToKeep() const;
  27. virtual void rollOver();
  28. static unsigned int maxDaysToKeepDefault;
  29. protected:
  30. virtual void _append(const LoggingEvent& event);
  31. unsigned int _maxDaysToKeep;
  32. // last log's file creation time (or last modification if appender just created)
  33. struct tm _logsTime;
  34. };
  35. }
  36. #endif // _LOG4CPP_DAILYROLLINGFILEAPPENDER_HH