CuteLogger
Fast and simple logging solution for Qt based applications
Public Member Functions | Protected Member Functions | List of all members
ConsoleAppender Class Reference

ConsoleAppender is the simple appender that writes the log records to the std::cerr output stream. More...

Inheritance diagram for ConsoleAppender:
AbstractStringAppender AbstractAppender

Public Member Functions

virtual QString format () const
 Returns the current log format string. More...
 
- Public Member Functions inherited from AbstractStringAppender
 AbstractStringAppender ()
 Constructs a new string appender object.
 
void setFormat (const QString &)
 Sets the logging format for writing strings to the log target with this appender. More...
 
- Public Member Functions inherited from AbstractAppender
 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...
 

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)
 Writes the log record to the std::cerr stream. More...
 
- Protected Member Functions inherited from AbstractStringAppender
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

- Static Public Member Functions inherited from AbstractStringAppender
static QString stripFunctionName (const char *)
 Strips the long function signature (as added by Q_FUNC_INFO macro) More...
 

Detailed Description

ConsoleAppender is the simple appender that writes the log records to the std::cerr output stream.

ConsoleAppender uses "[%{type:-7}] <%{function}> %{message}\n" as a default output format. It is similar to the AbstractStringAppender but doesn't show a timestamp.

You can modify ConsoleAppender output format without modifying your code by using QT_MESSAGE_PATTERN environment variable. If you need your application to ignore this environment variable you can call ConsoleAppender::ignoreEnvironmentPattern(true)

Member Function Documentation

◆ append()

void ConsoleAppender::append ( const QDateTime &  timeStamp,
Logger::LogLevel  logLevel,
const char *  file,
int  line,
const char *  function,
const QString &  category,
const QString &  message 
)
protectedvirtual

Writes the log record to the std::cerr stream.

See also
AbstractStringAppender::format()

Implements AbstractAppender.

◆ format()

QString ConsoleAppender::format ( ) const
virtual

Returns the current log format string.

The default format is set to "%{time}{yyyy-MM-ddTHH:mm:ss.zzz} [%{type:-7}] <%{function}> %{message}\n". You can set a different log record format using the setFormat() function.

See also
setFormat(const QString&)

Reimplemented from AbstractStringAppender.


The documentation for this class was generated from the following files: