Save server logs to logs/ instead of config/

This commit is contained in:
MangosArentLiterature 2021-04-03 20:35:21 -05:00
parent 428053934a
commit 6511e13585

View File

@ -88,10 +88,14 @@ void Logger::addEntry(QString entry)
void Logger::flush() void Logger::flush()
{ {
QDir dir("logs/");
if (!dir.exists()) {
dir.mkpath(".");
}
// raiden suggested this, but idk if i want to use it // raiden suggested this, but idk if i want to use it
// QString time = QDateTime::currentDateTime().toString("ddd mm/dd/yy hh:mm:ss"); // QString time = QDateTime::currentDateTime().toString("ddd mm/dd/yy hh:mm:ss");
// QString filename = QStringLiteral("reports/%1/%2.log").arg(area->name).arg(time); // QString filename = QStringLiteral("reports/%1/%2.log").arg(area->name).arg(time);
QFile logfile("config/server.log"); QFile logfile("logs/server.log");
if (logfile.open(QIODevice::WriteOnly | QIODevice::Append)) { if (logfile.open(QIODevice::WriteOnly | QIODevice::Append)) {
QTextStream file_stream(&logfile); QTextStream file_stream(&logfile);
while (!buffer.isEmpty()) while (!buffer.isEmpty())