|
pure-cpp 1.0.0
A C++ physics simulation benchmark comparing performance with Python implementations
|
Manages application logging based on command-line arguments. More...
#include <logger.hpp>

Public Member Functions | |
| Logger (const CmdLine::CmdLineArgs &in_args) | |
| Initialises the logger and installs the custom message handler. More... | |
| ~Logger () | |
| Restores the original message handler and cleans up logging resources, such as closing the log file. More... | |
| Logger (const Logger &)=delete | |
| Logger & | operator= (const Logger &)=delete |
| Logger (Logger &&)=delete | |
| Logger & | operator= (Logger &&)=delete |
Static Private Member Functions | |
| static void | messageHandler (QtMsgType type, const QMessageLogContext &context, const QString &msg) |
| The static Qt message handler that intercepts all log messages. More... | |
Private Attributes | |
| const CmdLine::CmdLineArgs & | args_ |
| A reference to the parsed command-line arguments. More... | |
| QSet< QtMsgType > | activeLevels_ |
| The set of Qt message types to be logged. More... | |
| QHash< QtMsgType, QString > | levelPrefixes_ |
| A map from message type to its string prefix (e.g., “[debug]”). More... | |
| std::unique_ptr< QFile > | logFile_ |
| A smart pointer to the log file. More... | |
| std::unique_ptr< QTextStream > | logStream_ |
| A smart pointer to the text stream for writing to the log file. More... | |
| QtMessageHandler | oldHandler_ = nullptr |
| Stores the original Qt message handler to be restored on exit. More... | |
Static Private Attributes | |
| static Logger * | instance_ = nullptr |
| Singleton instance of the logger. More... | |
Manages application logging based on command-line arguments.
Definition at line 36 of file logger.hpp.
|
inlineexplicit |
Initialises the logger and installs the custom message handler.
| in_args | The parsed command-line arguments. |
Definition at line 44 of file logger.hpp.
|
inline |
Restores the original message handler and cleans up logging resources, such as closing the log file.
Definition at line 91 of file logger.hpp.
|
inlinestaticprivate |
The static Qt message handler that intercepts all log messages.
This function filters messages based on the current log level and routes them to the configured outputs (console, file, syslog).
| type | The level of the message (e.g., QtDebugMsg). |
| context | The context where the message was generated. |
| msg | The log message. |
Definition at line 123 of file logger.hpp.
|
private |
The set of Qt message types to be logged.
Definition at line 156 of file logger.hpp.
|
private |
A reference to the parsed command-line arguments.
Definition at line 153 of file logger.hpp.
|
inlinestaticprivate |
Singleton instance of the logger.
Definition at line 150 of file logger.hpp.
|
private |
A map from message type to its string prefix (e.g., “[debug]”).
Definition at line 162 of file logger.hpp.
|
private |
A smart pointer to the log file.
Definition at line 165 of file logger.hpp.
|
private |
A smart pointer to the text stream for writing to the log file.
Definition at line 171 of file logger.hpp.
|
private |
Stores the original Qt message handler to be restored on exit.
Definition at line 177 of file logger.hpp.