38 lines
954 B
C++
38 lines
954 B
C++
//==============================================================================
|
|
//
|
|
// Класс Logger - singletone
|
|
//
|
|
//==============================================================================
|
|
#pragma once
|
|
#ifndef SINGLETONE_LOGGER_H
|
|
#define SINGLETONE_LOGGER_H
|
|
|
|
#include <QtCore/QObject>
|
|
#include <QtCore/QString>
|
|
#include <QtCore/QFile>
|
|
|
|
//==============================================================================
|
|
class Logger : public QObject
|
|
{
|
|
Q_OBJECT
|
|
Q_DISABLE_COPY(Logger)
|
|
|
|
public:
|
|
static Logger& instance();
|
|
static QString logTypeToString(QtMsgType msgType);
|
|
|
|
public slots:
|
|
void start();
|
|
void stop();
|
|
void writeLog(QtMsgType type, const QMessageLogContext &context, const QString &msg);
|
|
|
|
private:
|
|
QFile logFile;
|
|
explicit Logger(QObject *parent = nullptr);
|
|
virtual ~Logger();
|
|
};
|
|
|
|
//==============================================================================
|
|
#endif // SINGLETONE_LOGGER_H
|
|
|