aboutsummaryrefslogtreecommitdiff
path: root/launcher
diff options
context:
space:
mode:
authorRachel Powers <508861+Ryex@users.noreply.github.com>2023-04-02 19:43:43 -0700
committerRachel Powers <508861+Ryex@users.noreply.github.com>2023-05-01 10:48:00 -0700
commitfe36471b8dfad6156b735f9393072b9111a12547 (patch)
tree516add8da34a0957498155f87536afa1274fed1b /launcher
parent6b28af6cc5cc935bff47fcf8f4534827c958dbc3 (diff)
downloadPrismLauncher-fe36471b8dfad6156b735f9393072b9111a12547.tar.gz
PrismLauncher-fe36471b8dfad6156b735f9393072b9111a12547.tar.bz2
PrismLauncher-fe36471b8dfad6156b735f9393072b9111a12547.zip
refactor: logging.h -> Logging.h
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
Diffstat (limited to 'launcher')
-rw-r--r--launcher/CMakeLists.txt22
-rw-r--r--launcher/net/Download.cpp2
-rw-r--r--launcher/net/FileSink.cpp2
-rw-r--r--launcher/net/HttpMetaCache.cpp14
-rw-r--r--launcher/net/Logging.cpp (renamed from launcher/net/logging.cpp)6
-rw-r--r--launcher/net/Logging.h (renamed from launcher/net/logging.h)4
-rw-r--r--launcher/net/MetaCacheSink.cpp10
-rw-r--r--launcher/net/PasteUpload.cpp2
-rw-r--r--launcher/net/Upload.cpp2
9 files changed, 43 insertions, 21 deletions
diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt
index e49a4562..5253a517 100644
--- a/launcher/CMakeLists.txt
+++ b/launcher/CMakeLists.txt
@@ -123,8 +123,8 @@ set(NET_SOURCES
net/HttpMetaCache.h
net/MetaCacheSink.cpp
net/MetaCacheSink.h
- net/logging.h
- net/logging.cpp
+ net/Logging.h
+ net/Logging.cpp
net/NetAction.h
net/NetJob.cpp
net/NetJob.h
@@ -596,6 +596,24 @@ ecm_qt_export_logging_category(
EXPORT "${Launcher_Name}"
)
+ecm_qt_export_logging_category(
+ IDENTIFIER taskMetaCacheLogC
+ CATEGORY_NAME "launcher.task.net.metacache"
+ DEFAULT_SEVERITY Debug
+ DESCRIPTION "task network meta-cache actions"
+ EXPORT "${Launcher_Name}"
+)
+
+ecm_qt_export_logging_category(
+ IDENTIFIER taskHttpMetaCacheLogC
+ CATEGORY_NAME "launcher.task.net.metacache.http"
+ DEFAULT_SEVERITY Debug
+ DESCRIPTION "task network http meta-cache actions"
+ EXPORT "${Launcher_Name}"
+)
+
+
+
if(KDE_INSTALL_LOGGINGCATEGORIESDIR) # only install if there is a standard path for this
ecm_qt_install_logging_categories(
EXPORT "${Launcher_Name}"
diff --git a/launcher/net/Download.cpp b/launcher/net/Download.cpp
index e7536dc9..bfd0be28 100644
--- a/launcher/net/Download.cpp
+++ b/launcher/net/Download.cpp
@@ -51,7 +51,7 @@
#include "BuildConfig.h"
#include "Application.h"
-#include "logging.h"
+#include "net/Logging.h"
#include "net/NetAction.h"
namespace Net {
diff --git a/launcher/net/FileSink.cpp b/launcher/net/FileSink.cpp
index d5f09012..1ecb21fd 100644
--- a/launcher/net/FileSink.cpp
+++ b/launcher/net/FileSink.cpp
@@ -37,7 +37,7 @@
#include "FileSystem.h"
-#include "logging.h"
+#include "net/Logging.h"
namespace Net {
diff --git a/launcher/net/HttpMetaCache.cpp b/launcher/net/HttpMetaCache.cpp
index c90f8d4d..e521c9e9 100644
--- a/launcher/net/HttpMetaCache.cpp
+++ b/launcher/net/HttpMetaCache.cpp
@@ -44,7 +44,7 @@
#include <QDebug>
-#include "logging.h"
+#include "net/Logging.h"
auto MetaEntry::getFullPath() -> QString
{
@@ -139,12 +139,12 @@ auto HttpMetaCache::resolveEntry(QString base, QString resource_path, QString ex
auto HttpMetaCache::updateEntry(MetaEntryPtr stale_entry) -> bool
{
if (!m_entries.contains(stale_entry->m_baseId)) {
- qCCritical(taskNetLogC) << "[HttpMetaCache]" << "Cannot add entry with unknown base: " << stale_entry->m_baseId.toLocal8Bit();
+ qCCritical(taskHttpMetaCacheLogC) << "Cannot add entry with unknown base: " << stale_entry->m_baseId.toLocal8Bit();
return false;
}
if (stale_entry->m_stale) {
- qCCritical(taskNetLogC) << "[HttpMetaCache]" << "Cannot add stale entry: " << stale_entry->getFullPath().toLocal8Bit();
+ qCCritical(taskHttpMetaCacheLogC) << "Cannot add stale entry: " << stale_entry->getFullPath().toLocal8Bit();
return false;
}
@@ -168,10 +168,10 @@ void HttpMetaCache::evictAll()
{
for (QString& base : m_entries.keys()) {
EntryMap& map = m_entries[base];
- qCDebug(taskNetLogC) << "[HttpMetaCache]" << "Evicting base" << base;
+ qCDebug(taskHttpMetaCacheLogC) << "Evicting base" << base;
for (MetaEntryPtr entry : map.entry_list) {
if (!evictEntry(entry))
- qCWarning(taskNetLogC) << "[HttpMetaCache]" << "Unexpected missing cache entry" << entry->m_basePath;
+ qCWarning(taskHttpMetaCacheLogC) << "Unexpected missing cache entry" << entry->m_basePath;
}
}
}
@@ -269,7 +269,7 @@ void HttpMetaCache::SaveNow()
if (m_index_file.isNull())
return;
- qCDebug(taskNetLogC) << "[HttpMetaCache]" << "Saving metacache with" << m_entries.size() << "entries";
+ qCDebug(taskHttpMetaCacheLogC) << "Saving metacache with" << m_entries.size() << "entries";
QJsonObject toplevel;
Json::writeString(toplevel, "version", "1");
@@ -304,6 +304,6 @@ void HttpMetaCache::SaveNow()
try {
Json::write(toplevel, m_index_file);
} catch (const Exception& e) {
- qCWarning(taskNetLogC) << "[HttpMetaCache]" << e.what();
+ qCWarning(taskHttpMetaCacheLogC) << "Error writing cache:" << e.what();
}
}
diff --git a/launcher/net/logging.cpp b/launcher/net/Logging.cpp
index e5b42bc4..a9b9db7c 100644
--- a/launcher/net/logging.cpp
+++ b/launcher/net/Logging.cpp
@@ -17,8 +17,10 @@
*
*/
-#include "logging.h"
+#include "net/Logging.h"
Q_LOGGING_CATEGORY(taskNetLogC, "launcher.task.net")
Q_LOGGING_CATEGORY(taskDownloadLogC, "launcher.task.net.download")
-Q_LOGGING_CATEGORY(taskUploadLogC, "launcher.task.net.upload") \ No newline at end of file
+Q_LOGGING_CATEGORY(taskUploadLogC, "launcher.task.net.upload")
+Q_LOGGING_CATEGORY(taskMetaCacheLogC, "launcher.task.net.metacache")
+Q_LOGGING_CATEGORY(taskHttpMetaCacheLogC, "launcher.task.net.metacache.http")
diff --git a/launcher/net/logging.h b/launcher/net/Logging.h
index e65e328c..b692e707 100644
--- a/launcher/net/logging.h
+++ b/launcher/net/Logging.h
@@ -23,4 +23,6 @@
Q_DECLARE_LOGGING_CATEGORY(taskNetLogC)
Q_DECLARE_LOGGING_CATEGORY(taskDownloadLogC)
-Q_DECLARE_LOGGING_CATEGORY(taskUploadLogC) \ No newline at end of file
+Q_DECLARE_LOGGING_CATEGORY(taskUploadLogC)
+Q_DECLARE_LOGGING_CATEGORY(taskMetaCacheLogC)
+Q_DECLARE_LOGGING_CATEGORY(taskHttpMetaCacheLogC)
diff --git a/launcher/net/MetaCacheSink.cpp b/launcher/net/MetaCacheSink.cpp
index fc997553..e203bc06 100644
--- a/launcher/net/MetaCacheSink.cpp
+++ b/launcher/net/MetaCacheSink.cpp
@@ -39,7 +39,7 @@
#include <QRegularExpression>
#include "Application.h"
-#include "logging.h"
+#include "net/Logging.h"
namespace Net {
@@ -99,11 +99,11 @@ Task::State MetaCacheSink::finalizeCache(QNetworkReply & reply)
{ // Cache lifetime
if (m_is_eternal) {
- qCDebug(taskNetLogC) << "[MetaCache] Adding eternal cache entry:" << m_entry->getFullPath();
+ qCDebug(taskMetaCacheLogC) << "Adding eternal cache entry:" << m_entry->getFullPath();
m_entry->makeEternal(true);
} else if (reply.hasRawHeader("Cache-Control")) {
auto cache_control_header = reply.rawHeader("Cache-Control");
- // qCDebug(taskNetLogC) << "[MetaCache] Parsing 'Cache-Control' header with" << cache_control_header;
+ qCDebug(taskMetaCacheLogC) << "Parsing 'Cache-Control' header with" << cache_control_header;
QRegularExpression max_age_expr("max-age=([0-9]+)");
qint64 max_age = max_age_expr.match(cache_control_header).captured(1).toLongLong();
@@ -111,7 +111,7 @@ Task::State MetaCacheSink::finalizeCache(QNetworkReply & reply)
} else if (reply.hasRawHeader("Expires")) {
auto expires_header = reply.rawHeader("Expires");
- // qCDebug(taskNetLogC) << "[MetaCache] Parsing 'Expires' header with" << expires_header;
+ qCDebug(taskMetaCacheLogC) << "Parsing 'Expires' header with" << expires_header;
qint64 max_age = QDateTime::fromString(expires_header).toSecsSinceEpoch() - QDateTime::currentSecsSinceEpoch();
m_entry->setMaximumAge(max_age);
@@ -121,7 +121,7 @@ Task::State MetaCacheSink::finalizeCache(QNetworkReply & reply)
if (reply.hasRawHeader("Age")) {
auto age_header = reply.rawHeader("Age");
- // qCDebug(taskNetLogC) << "[MetaCache] Parsing 'Age' header with" << age_header;
+ qCDebug(taskMetaCacheLogC) << "Parsing 'Age' header with" << age_header;
qint64 current_age = age_header.toLongLong();
m_entry->setCurrentAge(current_age);
diff --git a/launcher/net/PasteUpload.cpp b/launcher/net/PasteUpload.cpp
index 9c2b20c6..595279a3 100644
--- a/launcher/net/PasteUpload.cpp
+++ b/launcher/net/PasteUpload.cpp
@@ -47,7 +47,7 @@
#include <QFile>
#include <QUrlQuery>
-#include "logging.h"
+#include "net/Logging.h"
std::array<PasteUpload::PasteTypeInfo, 4> PasteUpload::PasteTypes = {
{{"0x0.st", "https://0x0.st", ""},
diff --git a/launcher/net/Upload.cpp b/launcher/net/Upload.cpp
index 85f364d3..8045f850 100644
--- a/launcher/net/Upload.cpp
+++ b/launcher/net/Upload.cpp
@@ -43,7 +43,7 @@
#include "BuildConfig.h"
#include "Application.h"
-#include "logging.h"
+#include "net/Logging.h"
namespace Net {