CuteLogger
Fast and simple logging solution for Qt based applications
|
The RollingFileAppender class extends FileAppender so that the underlying file is rolled over at a user chosen frequency. More...
#include <RollingFileAppender.h>
Public Types | |
enum | DatePattern { MinutelyRollover = 0, HourlyRollover, HalfDailyRollover, DailyRollover, WeeklyRollover, MonthlyRollover } |
Protected Member Functions | |
virtual void | append (const QDateTime &timeStamp, Logger::LogLevel logLevel, const char *file, int line, const char *function, const QString &category, const QString &message) |
Write the log record to the file. More... | |
![]() | |
QString | formattedString (const QDateTime &timeStamp, Logger::LogLevel logLevel, const char *file, int line, const char *function, const QString &category, const QString &message) const |
Returns the string to record to the logging target, formatted according to the format(). More... | |
Additional Inherited Members | |
![]() | |
FileAppender (const QString &fileName=QString()) | |
Constructs the new file appender assigned to file with the given name. | |
QString | fileName () const |
Returns the name set by setFileName() or to the FileAppender constructor. More... | |
void | setFileName (const QString &) |
Sets the name of the file. The name can have no path, a relative path, or an absolute path. More... | |
![]() | |
AbstractStringAppender () | |
Constructs a new string appender object. | |
virtual QString | format () const |
Returns the current log format string. More... | |
void | setFormat (const QString &) |
Sets the logging format for writing strings to the log target with this appender. More... | |
![]() | |
AbstractAppender () | |
Constructs a AbstractAppender object. | |
virtual | ~AbstractAppender () |
Destructs the AbstractAppender object. | |
Logger::LogLevel | detailsLevel () const |
Returns the current details level of appender. More... | |
void | setDetailsLevel (Logger::LogLevel level) |
Sets the current details level of appender. More... | |
void | setDetailsLevel (const QString &level) |
Sets the current details level of appender. More... | |
void | write (const QDateTime &timeStamp, Logger::LogLevel logLevel, const char *file, int line, const char *function, const QString &category, const QString &message) |
Tries to write the log record to this logger. More... | |
![]() | |
static QString | stripFunctionName (const char *) |
Strips the long function signature (as added by Q_FUNC_INFO macro) More... | |
The RollingFileAppender class extends FileAppender so that the underlying file is rolled over at a user chosen frequency.
The class is based on Log4Qt.DailyRollingFileAppender class (http://log4qt.sourceforge.net/) and has the same date pattern format.
For example, if the fileName is set to /foo/bar and the DatePattern set to the daily rollover ('.'yyyy-MM-dd'.log'), on 2014-02-16 at midnight, the logging file /foo/bar.log will be copied to /foo/bar.2014-02-16.log and logging for 2014-02-17 will continue in /foo/bar until it rolls over the next day.
The logFilesLimit parameter is used to automatically delete the oldest log files in the directory during rollover (so no more than logFilesLimit recent log files exist in the directory at any moment).
The enum DatePattern defines constants for date patterns.
|
protectedvirtual |
Write the log record to the file.
Reimplemented from FileAppender.