LibrePCB Developers Documentation
MessageLogger Class Referencefinal

Generic logger class to pass messages between objects. More...

#include <messagelogger.h>

Inherits QObject.

+ Collaboration diagram for MessageLogger:

Classes

struct  Message
 

Public Types

enum class  ColorTheme
 

Signals

void msgEmitted (const Message &msg)
 

Public Member Functions

 MessageLogger (bool record=true, QObject *parent=nullptr) noexcept
 (Default) construdtor creating a top-level logger More...
 
 MessageLogger (MessageLogger *parentLogger, const QString &group=QString(), bool record=false, QObject *parent=nullptr) noexcept
 Constructor for a (conditionally) child logger. More...
 
 MessageLogger (const MessageLogger &other)=delete
 Copy constructor. More...
 
virtual ~MessageLogger () noexcept
 Destructor. More...
 
bool hasMessages () const noexcept
 
QList< MessagegetMessages () const noexcept
 
QStringList getMessagesPlain () const noexcept
 
QString getMessagesRichText (ColorTheme theme) const noexcept
 
void clear () noexcept
 
void log (QtMsgType type, const QString &msg) noexcept
 
void debug (const QString &msg) noexcept
 
void info (const QString &msg) noexcept
 
void warning (const QString &msg) noexcept
 
void critical (const QString &msg) noexcept
 
MessageLoggeroperator= (const MessageLogger &rhs)=delete
 

Private Attributes

QRecursiveMutex mMutex
 
QPointer< MessageLoggermParent
 
QString mPrefix
 
bool mRecord
 
QList< MessagemMessages
 

Detailed Description

Generic logger class to pass messages between objects.

Note
This class is thread-safe, i.e. several threads can log or retrieve logging messages simultanously.

Member Enumeration Documentation

◆ ColorTheme

enum class ColorTheme
strong
Enumerator
None 
Light 
Dark 

Constructor & Destructor Documentation

◆ MessageLogger() [1/3]

MessageLogger ( bool  record = true,
QObject *  parent = nullptr 
)
noexcept

(Default) construdtor creating a top-level logger

◆ MessageLogger() [2/3]

MessageLogger ( MessageLogger parentLogger,
const QString &  group = QString(),
bool  record = false,
QObject *  parent = nullptr 
)
noexcept

Constructor for a (conditionally) child logger.

◆ MessageLogger() [3/3]

MessageLogger ( const MessageLogger other)
delete

Copy constructor.

Parameters
otherObject to copy.

◆ ~MessageLogger()

~MessageLogger ( )
virtualnoexcept

Destructor.

Member Function Documentation

◆ hasMessages()

bool hasMessages ( ) const
noexcept

◆ getMessages()

QList< MessageLogger::Message > getMessages ( ) const
noexcept
+ Here is the caller graph for this function:

◆ getMessagesPlain()

QStringList getMessagesPlain ( ) const
noexcept
+ Here is the call graph for this function:

◆ getMessagesRichText()

QString getMessagesRichText ( ColorTheme  theme) const
noexcept
+ Here is the call graph for this function:

◆ clear()

void clear ( )
noexcept

◆ log()

void log ( QtMsgType  type,
const QString &  msg 
)
noexcept

◆ debug()

void debug ( const QString &  msg)
noexcept

◆ info()

void info ( const QString &  msg)
noexcept
+ Here is the caller graph for this function:

◆ warning()

void warning ( const QString &  msg)
noexcept
+ Here is the caller graph for this function:

◆ critical()

void critical ( const QString &  msg)
noexcept
+ Here is the caller graph for this function:

◆ operator=()

MessageLogger & operator= ( const MessageLogger rhs)
delete

◆ msgEmitted

void msgEmitted ( const Message msg)
signal

Member Data Documentation

◆ mMutex

QRecursiveMutex mMutex
mutableprivate

◆ mParent

QPointer<MessageLogger> mParent
private

◆ mPrefix

QString mPrefix
private

◆ mRecord

bool mRecord
private

◆ mMessages

QList<Message> mMessages
private

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