mirror of
https://github.com/redstrate/Astra.git
synced 2025-04-23 21:07:45 +00:00
32 lines
1.1 KiB
C++
32 lines
1.1 KiB
C++
// SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
#include "processlogger.h"
|
|
#include "astra_log.h"
|
|
#include "utility.h"
|
|
#include <QStandardPaths>
|
|
|
|
ProcessLogger::ProcessLogger(QProcess *process)
|
|
{
|
|
const QDir dataDir = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
|
|
const QDir logDirectory = dataDir.absoluteFilePath(QStringLiteral("log"));
|
|
|
|
m_file.setFileName(logDirectory.absoluteFilePath(QStringLiteral("ffxiv.log")));
|
|
m_file.open(QIODevice::WriteOnly | QIODevice::Unbuffered);
|
|
|
|
connect(process, &QProcess::readyReadStandardOutput, this, [this, process] {
|
|
m_file.write(process->readAllStandardOutput());
|
|
m_file.flush();
|
|
});
|
|
|
|
connect(process, &QProcess::readyReadStandardError, this, [this, process] {
|
|
m_file.write(process->readAllStandardError());
|
|
m_file.flush();
|
|
});
|
|
|
|
connect(process, &QProcess::finished, this, [this] {
|
|
deleteLater();
|
|
});
|
|
|
|
qInfo(ASTRA_LOG) << "Client logs are being written to" << m_file.fileName().toUtf8().constData();
|
|
}
|