CuteLogger
Fast and simple logging solution for Qt based applications
|
Simple appender that writes the log records to the plain text file. More...
Public Member Functions | |
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. | |
void | setFileName (const QString &) |
Sets the name of the file. The name can have no path, a relative path, or an absolute path. | |
void | setFlushOnWrite (bool) |
Allows FileAppender to flush file immediately after writing a log record. | |
bool | flush () |
Force-flush any remaining buffers to file system. Returns true if successful, otherwise returns false. | |
![]() | |
AbstractStringAppender () | |
Constructs a new string appender object. | |
virtual QString | format () const |
Returns the current log format string. | |
void | setFormat (const QString &) |
Sets the logging format for writing strings to the log target with this appender. | |
![]() | |
AbstractAppender () | |
Constructs a AbstractAppender object. | |
virtual | ~AbstractAppender () |
Destructs the AbstractAppender object. | |
Logger::LogLevel | detailsLevel () const |
Returns the current details level of appender. | |
void | setDetailsLevel (Logger::LogLevel level) |
Sets the current details level of appender. | |
void | setDetailsLevel (const QString &level) |
Sets the current details level of appender. | |
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. | |
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. | |
![]() | |
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(). | |
virtual void | append (const QDateTime &timeStamp, Logger::LogLevel logLevel, const char *file, int line, const char *function, const QString &category, const QString &message)=0 |
Writes the log record to the logger instance. | |
Additional Inherited Members | |
![]() | |
static QString | stripFunctionName (const char *) |
Strips the long function signature (as added by Q_FUNC_INFO macro) | |
Simple appender that writes the log records to the plain text file.
|
protectedvirtual |
Write the log record to the file.
Implements AbstractAppender.
Reimplemented in RollingFileAppender.
QString FileAppender::fileName | ( | ) | const |
Returns the name set by setFileName() or to the FileAppender constructor.
void FileAppender::setFileName | ( | const QString & | s | ) |
Sets the name of the file. The name can have no path, a relative path, or an absolute path.
void FileAppender::setFlushOnWrite | ( | bool | flush | ) |
Allows FileAppender to flush file immediately after writing a log record.
Default value is false. This could result in substantial app slowdown when writing massive amount of log records with FileAppender on a rather slow file system due to FileAppender blocking until the data would be phisically written.
Leaving this as is may result in some log data not being written if the application crashes.