38#define PRINT_STDOUT() StreamPrinter(stdout, __LINE__, __FILE__)
39#define PRINT_STDERR() StreamPrinter(stderr, __LINE__, __FILE__)
41#define DEBUG() LogHelper(Logger::LogLevel::LOG_DEBUG, __LINE__, __FILE__)
42#define VERBOSE() LogHelper(Logger::LogLevel::LOG_VERBOSE, __LINE__, __FILE__)
43#define INFO() LogHelper(Logger::LogLevel::LOG_INFO, __LINE__, __FILE__)
44#define WARN() LogHelper(Logger::LogLevel::LOG_WARNING, __LINE__, __FILE__)
45#define ERROR() LogHelper(Logger::LogLevel::LOG_ERROR, __LINE__, __FILE__)
208 m_message <<
"Printed stdout message📓: ";
211 m_message <<
"Printed stderr message📓: ";
Definition joydpadxml.h:27
JoyDPadXml(T *joydpad, QObject *parent=nullptr)
Definition joydpadxml.cpp:17
simple helper class used for constructing log message and sending it to Logger
Definition logger.h:129
void logMessage(const QString &message, const Logger::LogLevel level, const uint lineno, const QString &filename)
bool is_message_sent
Definition logger.h:136
Logger::LogLevel level
Definition logger.h:133
Logger::LogLevel log_level
Definition logger.h:137
QString message
Definition logger.h:132
QString filename
Definition logger.h:135
uint lineno
Definition logger.h:134
LogHelper & operator<<(const QString &s)
Definition logger.h:163
void sendMessage()
Definition logger.h:157
LogHelper(const Logger::LogLevel level, const uint lineno, const QString &filename, const QString &message="")
Definition logger.h:139
~LogHelper()
Definition logger.h:151
LogHelper & operator<<(Message ch)
Definition logger.h:169
Custom singleton class used for logging across application.
Definition logger.h:58
static void setLogLevel(LogLevel level)
Set the highest logging level. Determines which messages are output to the output stream.
Definition logger.cpp:76
static void setCurrentStream(QTextStream *stream)
Definition logger.cpp:96
static bool isDebugEnabled()
Definition logger.cpp:260
LogLevel getCurrentLogLevel()
Get the current output level associated with the logger.
Definition logger.cpp:90
void logMessage(const QString &message, const Logger::LogLevel level, const uint lineno, const QString &filename)
Write an individual message to the text stream.
Definition logger.cpp:140
QFile outputFile
Definition logger.h:111
static Logger * createInstance(QTextStream *stream=nullptr, LogLevel outputLevel=LOG_INFO, QObject *parent=nullptr)
Create instance of logger, if there is any other instance it will de deleted.
Definition logger.cpp:250
static Logger * instance
Definition logger.h:109
static void setCurrentLogFile(QString filename)
Definition logger.cpp:172
QTextStream * outputStream
Definition logger.h:113
QTextStream outFileStream
Definition logger.h:112
QMutex logMutex
Definition logger.h:116
static QString getCurrentLogFile()
Definition logger.cpp:269
static QTextStream * getCurrentStream()
Definition logger.cpp:107
static void loggerMessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg)
log message handling function
Definition logger.cpp:210
void closeLogger(bool closeStream=true)
Flushes output stream and closes stream if requested.
Definition logger.cpp:118
LogLevel
Definition logger.h:64
@ LOG_MAX
Definition logger.h:71
@ LOG_NONE
Definition logger.h:65
@ LOG_DEBUG
Definition logger.h:70
@ LOG_INFO
Definition logger.h:68
@ LOG_WARNING
Definition logger.h:67
@ LOG_ERROR
Definition logger.h:66
@ LOG_VERBOSE
Definition logger.h:69
~Logger()
Close output stream and set instance to 0.
Definition logger.cpp:60
static Logger * getInstance(bool raiseExceptionForNull=true)
Get the Instance of logger.
Definition logger.h:94
bool isWritingToFile()
Definition logger.cpp:199
LogLevel outputLevel
Definition logger.h:115
QThread * loggingThread
Definition logger.h:117
Simple adapter for QTextStream additionally logging printed values Logs are printed when StreamPrinte...
Definition logger.h:191
StreamPrinter(FILE *file, uint lineno=0, QString filename="")
Definition logger.h:200
StreamPrinter & operator<<(const QString &s)
Definition logger.h:233
~StreamPrinter()
Definition logger.h:218
uint m_lineno
Definition logger.h:196
StreamPrinter & operator<<(Message ch)
Definition logger.h:226
QString m_filename
Definition logger.h:197
QTextStream m_stream
Definition logger.h:194
std::stringstream m_message
Definition logger.h:195