From cd9c9296bb1ac7af7ebbbf66931e731dbf581bc8 Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Sat, 26 Dec 2020 14:54:31 +0100 Subject: Port existing copyright statement to reuse using licensedigger --- lib/logging.h | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'lib/logging.h') diff --git a/lib/logging.h b/lib/logging.h index ce4131bb..77e0dad3 100644 --- a/lib/logging.h +++ b/lib/logging.h @@ -1,19 +1,7 @@ /****************************************************************************** - * Copyright (C) 2017 Kitsune Ral + * SPDX-FileCopyrightText: 2017 Kitsune Ral * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -- cgit v1.2.3 From 1b2b2ee36695d378a54753b7059acb4c063d7061 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sun, 27 Dec 2020 23:14:17 +0100 Subject: Add a new logging category for room member changes MEMBERS, aka quotient.events.members.* - this was promised in ff020f3b but not actually done "before merging". --- lib/logging.h | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/logging.h') diff --git a/lib/logging.h b/lib/logging.h index ce4131bb..05ca7988 100644 --- a/lib/logging.h +++ b/lib/logging.h @@ -23,6 +23,7 @@ Q_DECLARE_LOGGING_CATEGORY(MAIN) Q_DECLARE_LOGGING_CATEGORY(STATE) +Q_DECLARE_LOGGING_CATEGORY(MEMBERS) Q_DECLARE_LOGGING_CATEGORY(MESSAGES) Q_DECLARE_LOGGING_CATEGORY(EVENTS) Q_DECLARE_LOGGING_CATEGORY(EPHEMERAL) -- cgit v1.2.3 From 0a775d9b3209be15dea8b8915fc0a1c8e0046ba6 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sat, 16 Jan 2021 18:19:45 +0100 Subject: Updated copyright statements upon Git audit After going through all the files and the history of commits on them it was clear that some copyright statements are obsolete (the code has been overwritten since) and some are missing. This commit tries best to remedy that, along with adding SPDX tags where they were still not used. Also, a minimal SPDX convention is documented for further contributions. Closes #426. --- lib/logging.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'lib/logging.h') diff --git a/lib/logging.h b/lib/logging.h index 21d05d8b..432ed16f 100644 --- a/lib/logging.h +++ b/lib/logging.h @@ -1,8 +1,6 @@ -/****************************************************************************** - * SPDX-FileCopyrightText: 2017 Kitsune Ral - * - * SPDX-License-Identifier: LGPL-2.1-or-later - */ +// SPDX-FileCopyrightText: 2017 Elvis Angelaccio +// SPDX-FileCopyrightText: 2017 Kitsune Ral +// SPDX-License-Identifier: LGPL-2.1-or-later #pragma once -- cgit v1.2.3 From e9dace0e22a2aa3727bc842a30b4ad504029c0fc Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Fri, 16 Jul 2021 20:09:42 +0200 Subject: 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. --- lib/logging.h | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/logging.h') 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 { -- cgit v1.2.3 From c50420a0f2df7a7bf291312c38ac43e2c9f58141 Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Sun, 22 Aug 2021 20:15:04 +0200 Subject: Drop QMatrixClient namespace alias --- lib/logging.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'lib/logging.h') diff --git a/lib/logging.h b/lib/logging.h index 264215e1..1d1394e8 100644 --- a/lib/logging.h +++ b/lib/logging.h @@ -67,8 +67,6 @@ inline qint64 profilerMinNsecs() * 1000; } } // namespace Quotient -/// \deprecated Use namespace Quotient instead -namespace QMatrixClient = Quotient; inline QDebug operator<<(QDebug debug_object, const QElapsedTimer& et) { -- cgit v1.2.3 From df46414a4e16d608049610935aeabab222e06d72 Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Fri, 10 Sep 2021 21:53:22 +0200 Subject: Add "quotient.network" logging category --- lib/logging.h | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/logging.h') diff --git a/lib/logging.h b/lib/logging.h index 1d1394e8..7e0da975 100644 --- a/lib/logging.h +++ b/lib/logging.h @@ -17,6 +17,7 @@ Q_DECLARE_LOGGING_CATEGORY(E2EE) Q_DECLARE_LOGGING_CATEGORY(JOBS) Q_DECLARE_LOGGING_CATEGORY(SYNCJOB) Q_DECLARE_LOGGING_CATEGORY(THUMBNAILJOB) +Q_DECLARE_LOGGING_CATEGORY(NETWORK) Q_DECLARE_LOGGING_CATEGORY(PROFILER) namespace Quotient { -- cgit v1.2.3 From a1e885177bd9421a8ede4bec870a8fdc8b89a693 Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Mon, 11 Oct 2021 16:02:21 +0200 Subject: formatJson(QDebug): Drop some very old cruft --- lib/logging.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'lib/logging.h') diff --git a/lib/logging.h b/lib/logging.h index 7e0da975..5a3ef6ea 100644 --- a/lib/logging.h +++ b/lib/logging.h @@ -37,11 +37,7 @@ using QDebugManip = QDebug (*)(QDebug); */ inline QDebug formatJson(QDebug debug_object) { -#if QT_VERSION < QT_VERSION_CHECK(5, 4, 0) - return debug_object; -#else return debug_object.noquote(); -#endif } /** -- cgit v1.2.3 From d6cf6b32cdd2843c40fc696accd8a6456f1ea15c Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Fri, 19 Nov 2021 12:45:50 +0100 Subject: Make enum values logging more terse() By default enum class values are logged along with the qualifier; this may or may not be desirable in a given setting. For JoinState(s) and Membership(Mask) operator<< was overloaded to implicitly suppress qualification; however, this is both overly sweeping and uses Qt's internal API for the backend. Instead, a new QDebug manipulator, terse(), is introduced, that does the same as those operator<< overloads but on a per-invocation basis. This makes it slightly more verbose to log enums but makes the QDebug reconfiguration explicit and doesn't require to produce new overloads every time a new enum ends up in logs. And it's built entirely on the published Qt API, reusing the QDebugManip framework that Quotient already has. Also: operator<<(QDebug, QDebugManip) has been moved out of the namespace to fix lookup issues when there's no prior `using namespace Quotient`. --- lib/logging.h | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) (limited to 'lib/logging.h') diff --git a/lib/logging.h b/lib/logging.h index 5a3ef6ea..5bf050a9 100644 --- a/lib/logging.h +++ b/lib/logging.h @@ -40,17 +40,15 @@ inline QDebug formatJson(QDebug debug_object) return debug_object.noquote(); } -/** - * @brief A helper operator to facilitate usage of formatJson (and possibly - * other manipulators) - * - * @param debug_object to output the json to - * @param qdm a QDebug manipulator - * @return a copy of debug_object that has its mode altered by qdm - */ -inline QDebug operator<<(QDebug debug_object, QDebugManip qdm) +//! Suppress full qualification of enums/QFlags when logging +inline QDebug terse(QDebug dbg) { - return qdm(debug_object); + return +#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0) + dbg.setVerbosity(0), dbg; +#else + dbg.verbosity(QDebug::MinimumVerbosity); +#endif } inline qint64 profilerMinNsecs() @@ -65,6 +63,19 @@ inline qint64 profilerMinNsecs() } } // namespace Quotient +/** + * @brief A helper operator to facilitate usage of formatJson (and possibly + * other manipulators) + * + * @param debug_object to output the json to + * @param qdm a QDebug manipulator + * @return a copy of debug_object that has its mode altered by qdm + */ +inline QDebug operator<<(QDebug debug_object, Quotient::QDebugManip qdm) +{ + return qdm(debug_object); +} + inline QDebug operator<<(QDebug debug_object, const QElapsedTimer& et) { auto val = et.nsecsElapsed() / 1000; -- cgit v1.2.3 From 47bd4dfb2bc720d2b5919b93985f87d918af572a Mon Sep 17 00:00:00 2001 From: Tobias Fella Date: Tue, 7 Dec 2021 00:25:05 +0100 Subject: Port E2EE to database instead of JSON files --- lib/logging.h | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/logging.h') diff --git a/lib/logging.h b/lib/logging.h index 5bf050a9..fc0a4c99 100644 --- a/lib/logging.h +++ b/lib/logging.h @@ -19,6 +19,7 @@ Q_DECLARE_LOGGING_CATEGORY(SYNCJOB) Q_DECLARE_LOGGING_CATEGORY(THUMBNAILJOB) Q_DECLARE_LOGGING_CATEGORY(NETWORK) Q_DECLARE_LOGGING_CATEGORY(PROFILER) +Q_DECLARE_LOGGING_CATEGORY(DATABASE) namespace Quotient { // QDebug manipulators -- cgit v1.2.3 From 6b355d1aa87072143e09ea5269e8cf465318a64f Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Sat, 18 Jun 2022 21:26:43 +0200 Subject: Drop pre-Qt 5.15 code --- lib/logging.h | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'lib/logging.h') diff --git a/lib/logging.h b/lib/logging.h index fc0a4c99..c8d17210 100644 --- a/lib/logging.h +++ b/lib/logging.h @@ -44,12 +44,7 @@ inline QDebug formatJson(QDebug debug_object) //! Suppress full qualification of enums/QFlags when logging inline QDebug terse(QDebug dbg) { - return -#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0) - dbg.setVerbosity(0), dbg; -#else - dbg.verbosity(QDebug::MinimumVerbosity); -#endif + return dbg.verbosity(QDebug::MinimumVerbosity); } inline qint64 profilerMinNsecs() -- cgit v1.2.3 From 24a206f6429f6fa29b9aa1ce39b7e4694e39b046 Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Fri, 15 Jul 2022 10:32:27 +0200 Subject: operator<<(QDebug, QElapsedTimer): always use ms That switch between micro- and milliseconds was pure visual sugaring, in a potentially time-sensitive context. Also: there's no sense in using const-ref for a small parameter in a function that is, to top it off, almost always inlined. --- lib/logging.h | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'lib/logging.h') diff --git a/lib/logging.h b/lib/logging.h index c8d17210..2599efbf 100644 --- a/lib/logging.h +++ b/lib/logging.h @@ -72,12 +72,9 @@ inline QDebug operator<<(QDebug debug_object, Quotient::QDebugManip qdm) return qdm(debug_object); } -inline QDebug operator<<(QDebug debug_object, const QElapsedTimer& et) +inline QDebug operator<<(QDebug debug_object, QElapsedTimer et) { - auto val = et.nsecsElapsed() / 1000; - if (val < 1000) - debug_object << val << "µs"; - else - debug_object << val / 1000 << "ms"; + // Keep 3 decimal digits (the first division is int, the second is float) + debug_object << et.nsecsElapsed() / 1000 / 1000.0 << "ms"; return debug_object; } -- cgit v1.2.3 From 2cc19e66c0bed3065cf7274dbc908bcb90b7502e Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Sat, 16 Jul 2022 20:30:56 +0200 Subject: logging.h: suppress clang-tidy warnings --- lib/logging.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib/logging.h') diff --git a/lib/logging.h b/lib/logging.h index 2599efbf..1fafa04b 100644 --- a/lib/logging.h +++ b/lib/logging.h @@ -69,12 +69,13 @@ inline qint64 profilerMinNsecs() */ inline QDebug operator<<(QDebug debug_object, Quotient::QDebugManip qdm) { - return qdm(debug_object); + return qdm(debug_object); // NOLINT(performance-unnecessary-value-param) } inline QDebug operator<<(QDebug debug_object, QElapsedTimer et) { - // Keep 3 decimal digits (the first division is int, the second is float) - debug_object << et.nsecsElapsed() / 1000 / 1000.0 << "ms"; + // NOLINTNEXTLINE(bugprone-integer-division) + debug_object << static_cast(et.nsecsElapsed() / 1000) / 1000 + << "ms"; // Show in ms with 3 decimal digits precision return debug_object; } -- cgit v1.2.3