| 1234567891011121314151617181920212223242526272829303132 |
- #ifndef AVPLAYER2_LOG_H
- #define AVPLAYER2_LOG_H
- #pragma once
- #include <QFile>
- #include <QFileInfo>
- #include <QTextStream>
- #include <QTime>
- #include <QtDebug>
- #include <memory>
- void logOutput(const QtMsgType type, const QMessageLogContext& context, const QString& msg);
- class Logger
- {
- public:
- static Logger& instance()
- {
- static Logger instance;
- return instance;
- }
- void log(const QString& str);
- private:
- explicit Logger(const QString& file = "log.txt");
- virtual ~Logger();
- private:
- std::unique_ptr<QFile> m_logfile;
- std::unique_ptr<QTextStream> m_ts;
- };
- #endif // AVPLAYER2_LOG_H
|