mirror of
https://github.com/huderlem/porymap.git
synced 2026-08-12 11:55:44 -05:00
Some checks are pending
Build Porymap / build-linux (, 5.14.2) (push) Waiting to run
Build Porymap / build-linux (, 6.8.*) (push) Waiting to run
Build Porymap / build-linux (minimal, 5.14.2) (push) Waiting to run
Build Porymap / build-macos (macos-15-intel) (push) Waiting to run
Build Porymap / build-macos (macos-latest) (push) Waiting to run
Build Porymap / build-static-windows (push) Waiting to run
41 lines
842 B
C++
41 lines
842 B
C++
#pragma once
|
|
#ifndef LOGWRITER_H
|
|
#define LOGWRITER_H
|
|
|
|
#include "log.h"
|
|
|
|
#include <QFile>
|
|
#include <QMutex>
|
|
#include <QObject>
|
|
#include <QTextStream>
|
|
|
|
class LogWriter : public QObject
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
LogWriter(QObject *parent = nullptr);
|
|
LogWriter(const QString& path, QObject *parent = nullptr);
|
|
~LogWriter()=default;
|
|
|
|
bool setPath(const QString& path);
|
|
QString path() const;
|
|
|
|
void setConsoleEnabled(bool consoleEnabled);
|
|
bool consoleEnabled() const;
|
|
|
|
Q_SLOT void write(const QString& message, LogType type);
|
|
Q_SLOT void writeQt(const QString& message, QtMsgType type);
|
|
|
|
|
|
private:
|
|
QFile m_file;
|
|
QTextStream m_textStream;
|
|
bool m_consoleEnabled{true};
|
|
mutable QMutex m_mutex;
|
|
|
|
template <typename T>
|
|
void writeInternal(const QString& message, T type);
|
|
};
|
|
|
|
#endif // LOGWRITER_H
|