v2.0.0
Loading...
Searching...
No Matches
UTILSLIB::MNELogger Class Reference

Custom Qt message handler that formats and routes qDebug/qWarning/qCritical output to file or console. More...

#include <mne_logger.h>

Static Public Member Functions

static void customLogWriter (QtMsgType type, const QMessageLogContext &context, const QString &msg)
static bool setLogFile (const QString &sFilePath)
static QString logFile ()

Detailed Description

Custom Qt message handler that formats and routes qDebug/qWarning/qCritical output to file or console.

The Apllicationlogger provides colorized keywords in terminal outputs for better overview

Definition at line 58 of file mne_logger.h.

Member Function Documentation

◆ customLogWriter()

void MNELogger::customLogWriter ( QtMsgType type,
const QMessageLogContext & context,
const QString & msg )
static

Customized logWriter to colorize type of the message in the terminal

Parameters
[in]typeEnum to identify the various message types (qDebug, qInfo, qCritical, qWarning and qFatal).
[in]contextContext provides information about the source code location.
[in]msgThe message to print in the terminal.

Definition at line 105 of file mne_logger.cpp.

◆ logFile()

QString MNELogger::logFile ( )
static

Returns the path of the current log file, empty if file logging is off.

Returns
Path of the active log file, or an empty string if file logging is disabled.

Definition at line 98 of file mne_logger.cpp.

◆ setLogFile()

bool MNELogger::setLogFile ( const QString & sFilePath)
static

Additionally writes every message to a log file.

Console output is unaffected. The file is opened in append mode and each line is prefixed with a timestamp and the message level, without the terminal colour codes. Passing an empty path stops file logging.

Parameters
[in]sFilePathPath of the log file, or an empty string to disable.
Returns
True if the file could be opened for writing.

Definition at line 72 of file mne_logger.cpp.


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