/*
* DateRollingFileAppender.hh
*
* See the COPYING file for the terms of usage and distribution.
*/

#ifndef _LOG4CPP_DATEROLLINGFILEAPPENDER_HH
#define _LOG4CPP_DATEROLLINGFILEAPPENDER_HH


#include <log4cpp/Portability.hh>
#include <log4cpp/FileAppender.hh>
#include <string>
#include <stdarg.h>

namespace log4cpp {

	/**
	DateRollingFileAppender is a FileAppender that rolls over the logfile every month/week/day/hour.
	@since 1.0
	**/
	class LOG4CPP_EXPORT DateRollingFileAppender : public FileAppender {
	public:
		enum TypePeriod{
			TP_MONTHLY,
			TP_WEEKLY,
			TP_DAILY,
			TP_HOURLY,
		};

		DateRollingFileAppender(const std::string& name, 
			const std::string& fileName,
			TypePeriod per = TP_DAILY,
			bool append = true,
			mode_t mode = 00644);
		virtual void rollOver();
		static TypePeriod getTypePerFromString(const std::string & Parameter);
	protected:
		virtual void _append(const LoggingEvent& event);
		short _lastValue;
		TypePeriod _perType;
	};
}

#endif//_LOG4CPP_DATEROLLINGFILEAPPENDER_HH