mirror of
https://github.com/QuasarApp/QuasarAppLib.git
synced 2025-04-29 19:24:40 +00:00
fix logs
This commit is contained in:
parent
961e6608d9
commit
ebdd860531
10
qalogger.cpp
10
qalogger.cpp
@ -10,6 +10,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
|
#include <QDir>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
|
|
||||||
@ -93,13 +94,16 @@ void QALogger::init() {
|
|||||||
|
|
||||||
if (Params::isEndable("fileLog")) {
|
if (Params::isEndable("fileLog")) {
|
||||||
_toFile = true;
|
_toFile = true;
|
||||||
QString path = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + "/" + QCoreApplication::applicationName() + ".log";
|
QString path = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation);
|
||||||
|
QString filePath = path + "/" + QCoreApplication::applicationName() + ".log";
|
||||||
auto file = Params::getArg("fileLog");
|
auto file = Params::getArg("fileLog");
|
||||||
if (file.size()) {
|
if (file.size()) {
|
||||||
path = file;
|
filePath = file;
|
||||||
}
|
}
|
||||||
|
|
||||||
_logFile->setFileName(path);
|
QDir().mkpath(path);
|
||||||
|
|
||||||
|
_logFile->setFileName(filePath);
|
||||||
|
|
||||||
if (!_logFile->open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Text)) {
|
if (!_logFile->open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Text)) {
|
||||||
qFatal() << "Can't open log file";
|
qFatal() << "Can't open log file";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user