aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Rusakov <Kitsune-Ral@users.sf.net>2021-07-16 20:09:42 +0200
committerAlexey Rusakov <Kitsune-Ral@users.sf.net>2021-07-16 22:09:30 +0200
commite9dace0e22a2aa3727bc842a30b4ad504029c0fc (patch)
treef406ec377baa132f68233c0d7223fd6f839a8912
parent0cb9a462945b1a9dd30979e9b97415dff16816e0 (diff)
downloadlibquotient-e9dace0e22a2aa3727bc842a30b4ad504029c0fc.tar.gz
libquotient-e9dace0e22a2aa3727bc842a30b4ad504029c0fc.zip
Log thumbnail requests in their own category
As pointed out by one of users, thumbnail requests produce quite a bit of logging traffic, so it's better to manage them separately.
-rw-r--r--README.md10
-rw-r--r--lib/jobs/mediathumbnailjob.cpp8
-rw-r--r--lib/logging.cpp1
-rw-r--r--lib/logging.h1
4 files changed, 13 insertions, 7 deletions
diff --git a/README.md b/README.md
index c993c31e..d5aae543 100644
--- a/README.md
+++ b/README.md
@@ -196,11 +196,11 @@ libQuotient uses Qt's logging categories to make switching certain types of logg
quotient.<category>.<level>=<flag>
```
where
-- `<category>` is one of: `main`, `jobs`, `jobs.sync`, `events`, `events.state`
- (covering both the "usual" room state and account data), `events.messages`,
- `events.ephemeral`, `e2ee` and `profiler` (you can always find the full list
- in `lib/logging.cpp`)
-- `<level>` is one of `debug`, `info`, and `warning`
+- `<category>` is one of: `main`, `jobs`, `jobs.sync`, `jobs.thumbnail`,
+ `events`, `events.state` (covering both the "usual" room state and account
+ data), `events.messages`, `events.ephemeral`, `e2ee` and `profiler` (you can
+ always find the full list in `lib/logging.cpp`);
+- `<level>` is one of `debug`, `info`, and `warning`;
- `<flag>` is either `true` or `false`.
`*` can be used as a wildcard for any part between two dots, and semicolon is used for a separator. Latter statements override former ones, so if you want to switch on all debug logs except `jobs` you can set
diff --git a/lib/jobs/mediathumbnailjob.cpp b/lib/jobs/mediathumbnailjob.cpp
index 7dbf4ab3..6fe8ef26 100644
--- a/lib/jobs/mediathumbnailjob.cpp
+++ b/lib/jobs/mediathumbnailjob.cpp
@@ -17,13 +17,17 @@ MediaThumbnailJob::MediaThumbnailJob(const QString& serverName,
const QString& mediaId, QSize requestedSize)
: GetContentThumbnailJob(serverName, mediaId, requestedSize.width(),
requestedSize.height(), "scale")
-{}
+{
+ setLoggingCategory(THUMBNAILJOB);
+}
MediaThumbnailJob::MediaThumbnailJob(const QUrl& mxcUri, QSize requestedSize)
: MediaThumbnailJob(mxcUri.authority(),
mxcUri.path().mid(1), // sans leading '/'
requestedSize)
-{}
+{
+ setLoggingCategory(THUMBNAILJOB);
+}
QImage MediaThumbnailJob::thumbnail() const { return _thumbnail; }
diff --git a/lib/logging.cpp b/lib/logging.cpp
index af229684..ffcc851c 100644
--- a/lib/logging.cpp
+++ b/lib/logging.cpp
@@ -16,4 +16,5 @@ LOGGING_CATEGORY(EPHEMERAL, "quotient.events.ephemeral")
LOGGING_CATEGORY(E2EE, "quotient.e2ee")
LOGGING_CATEGORY(JOBS, "quotient.jobs")
LOGGING_CATEGORY(SYNCJOB, "quotient.jobs.sync")
+LOGGING_CATEGORY(THUMBNAILJOB, "quotient.jobs.thumbnail")
LOGGING_CATEGORY(PROFILER, "quotient.profiler")
diff --git a/lib/logging.h b/lib/logging.h
index 432ed16f..264215e1 100644
--- a/lib/logging.h
+++ b/lib/logging.h
@@ -16,6 +16,7 @@ Q_DECLARE_LOGGING_CATEGORY(EPHEMERAL)
Q_DECLARE_LOGGING_CATEGORY(E2EE)
Q_DECLARE_LOGGING_CATEGORY(JOBS)
Q_DECLARE_LOGGING_CATEGORY(SYNCJOB)
+Q_DECLARE_LOGGING_CATEGORY(THUMBNAILJOB)
Q_DECLARE_LOGGING_CATEGORY(PROFILER)
namespace Quotient {