swift
Loading...
Searching...
No Matches
swift::misc::CLogMessage Class Reference

Class for emitting a log message. More...

#include <logmessage.h>

Inheritance diagram for swift::misc::CLogMessage:
[legend]

Public Member Functions

 CLogMessage ()=default
 Construct a message with the "uncategorized" category.
 CLogMessage (const char *file, int line, const char *function)
 Constructor taking filename, line number, and function name, for uncategorized verbose debug messages.
 ~CLogMessage ()
 Destructor. This actually emits the message.
 operator CStatusMessage ()
 Convert to CStatusMessage for returning the message directly from the function which generated it.
 CMessageBase ()=default
 Inheriting constructors.
 CMessageBase (const CLogCategory &category)
 Inheriting constructors.
 CMessageBase (const CLogCategoryList &categories)
 Inheriting constructors.
 CMessageBase (const CLogCategoryList &categories, const CLogCategory &extra)
 Inheriting constructors.
 CMessageBase (const CLogCategoryList &categories, const CLogCategoryList &extra)
 Inheriting constructors.
Public Member Functions inherited from swift::misc::CMessageBase< CLogMessage >
 CMessageBase ()=default
 Default constructor.
CLogMessage & log (StatusSeverity s, const char16_t(&m)[N])
 Set the severity and format string.
CLogMessage & debug ()
 Set the severity to debug.
CLogMessage & info (const char16_t(&format)[N])
 Set the severity to info, providing a format string.
CLogMessage & warning (const char16_t(&format)[N])
 Set the severity to warning, providing a format string.
CLogMessage & error (const char16_t(&format)[N])
 Set the severity to error, providing a format string.
CLogMessage & validation (StatusSeverity s, const char16_t(&format)[N])
 Set the severity to s, providing a format string, and adding the validation category.
CLogMessage & validationInfo (const char16_t(&format)[N])
 Set the severity to info, providing a format string, and adding the validation category.
CLogMessage & validationWarning (const char16_t(&format)[N])
 Set the severity to warning, providing a format string, and adding the validation category.
CLogMessage & validationError (const char16_t(&format)[N])
 Set the severity to error, providing a format string, and adding the validation category.
CLogMessage & operator<< (T v)
 Streaming operators.
bool isEmpty () const
 Message empty.

Static Public Member Functions

static void preformatted (const CStatusMessage &statusMessage)
 Sends a verbatim, preformatted message to the log.
static void preformatted (const CStatusMessageList &statusMessages)
 Sends a list of verbatim, preformatted messages to the log.

Additional Inherited Members

Protected Member Functions inherited from swift::misc::CMessageBase< CLogMessage >
void addIfNotExisting (const CLogCategory &category)
 Add category if not already existing.
QString message () const
 Private.
Protected Attributes inherited from swift::misc::CMessageBase< CLogMessage >
CStrongStringView m_message
 Private.
QStringList m_args
 Private.
CLogCategoryList m_categories
 Private.
StatusSeverity m_severity
 Private.

Detailed Description

Class for emitting a log message.

Works similar to the qDebug, qWarning, qCritical family of functions.

The member functions debug, info, warning, error, and the stream operators all return a reference to *this, so they can be chained together.

The categories are arbitrary string tags which can be attached to the message to categorize it. A message can have more than one category. The categories can be used for filtering by message handlers.

Definition at line 26 of file logmessage.h.

Member Function Documentation

◆ CMessageBase() [1/4]

swift::misc::CMessageBase< Derived >::CMessageBase ( const CLogCategory & category)
inlineexplicit

Inheriting constructors.

Definition at line 168 of file statusmessage.h.

◆ CMessageBase() [2/4]

swift::misc::CMessageBase< Derived >::CMessageBase ( const CLogCategoryList & categories)
inlineexplicit

Inheriting constructors.

Definition at line 171 of file statusmessage.h.

◆ CMessageBase() [3/4]

swift::misc::CMessageBase< Derived >::CMessageBase ( const CLogCategoryList & categories,
const CLogCategory & extra )
inline

Inheriting constructors.

Definition at line 174 of file statusmessage.h.

◆ CMessageBase() [4/4]

swift::misc::CMessageBase< Derived >::CMessageBase ( const CLogCategoryList & categories,
const CLogCategoryList & extra )
inline

Inheriting constructors.

Definition at line 180 of file statusmessage.h.


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