Ios log 4 (#569)

iOS logging refactoring
This commit is contained in:
isamnezia 2024-02-10 19:44:55 +03:00 committed by GitHub
parent f2d13148a3
commit 158c11a0ec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 252 additions and 93 deletions

View file

@ -18,6 +18,10 @@
#include <core/ipcclient.h>
#endif
#ifdef Q_OS_IOS
#include <AmneziaVPN-Swift.h>
#endif
QFile Logger::m_file;
QTextStream Logger::m_textStream;
QString Logger::m_logFileName = QString("%1.log").arg(APPLICATION_NAME);
@ -107,7 +111,14 @@ QString Logger::getLogFile()
QFile file(userLogsFilePath());
file.open(QIODevice::ReadOnly);
return file.readAll();
QString qtLog = file.readAll();
#ifdef Q_OS_IOS
return QString().fromStdString(AmneziaVPN::swiftUpdateLogData(qtLog.toStdString()));
#else
return qtLog;
#endif
}
bool Logger::openLogsFolder()
@ -146,7 +157,11 @@ void Logger::clearLogs()
file.open(QIODevice::WriteOnly | QIODevice::Truncate);
file.resize(0);
file.close();
#ifdef Q_OS_IOS
AmneziaVPN::swiftDeleteLog();
#endif
if (isLogActive) {
init();
}