PylonRecorder/mylogger.h
2023-11-10 11:04:42 +01:00

33 lines
748 B
C++

//This file is modified from "https://github.com/VelazcoJD/QtLogging"
#ifndef MYLOGGER_H
#define MYLOGGER_H
#include <QDebug>
#include <QFile>
#include <QHash>
class Logger {
private:
/// @brief The file object where logs are written to.
static QFile* logFile;
/// @brief Whether the logger has being initialized.
static bool isInit;
/// @brief The different type of contexts.
static QHash<QtMsgType, QString> contextNames;
public:
/// @brief Initializes the logger.
static void init();
/// @brief Cleans up the logger.
static void clean();
/// @brief The function which handles the logging of text.
static void messageOutput(QtMsgType type, const QMessageLogContext& context,
const QString& msg);
};
#endif /* !MYLOGGER_H */