From: APTX Date: Sun, 26 Nov 2017 12:59:37 +0000 (+0900) Subject: Create a verbose category and filter it by default X-Git-Url: https://gitweb.aptx.org/?a=commitdiff_plain;h=6e519278af51c401cf5646ae54dde625db15b814;p=aniplayer.git Create a verbose category and filter it by default This silences all the current playback position log spam. --- diff --git a/backendplugins/backend_mpv/backendmpv.cpp b/backendplugins/backend_mpv/backendmpv.cpp index 3dadba5..bd3b22b 100644 --- a/backendplugins/backend_mpv/backendmpv.cpp +++ b/backendplugins/backend_mpv/backendmpv.cpp @@ -12,6 +12,7 @@ #include Q_LOGGING_CATEGORY(mpvBackend, "mpv") +Q_LOGGING_CATEGORY(mpvVerboseBackend, "mpv.verbose") Q_LOGGING_CATEGORY(mpvLog, "mpv.log") static constexpr const char VOLUME[] = "volume"; @@ -260,7 +261,7 @@ void MpvInstance::processMpvEvents() { event = mpv_wait_event(m_handle, 0); if (event->event_id == MPV_EVENT_NONE) break; - qCDebug(mpvBackend).nospace() + qCDebug(mpvVerboseBackend).nospace() << "Event " << mpv_event_name(event->event_id) << '(' << event->event_id << "), error: " << event->error; switch (event->event_id) { @@ -268,7 +269,7 @@ void MpvInstance::processMpvEvents() { if (!event->data) qCWarning(mpvBackend, "PROPERTY CHANGE data is null"); auto property = static_cast(event->data); - qCDebug(mpvBackend) << "Property" << property->name << "changed"; + qCDebug(mpvVerboseBackend) << "Property" << property->name << "changed"; if (property->format == MPV_FORMAT_NONE) { qCDebug(mpvBackend) << "No data in event"; break; diff --git a/core/main.cpp b/core/main.cpp index 6585b5e..c62e334 100644 --- a/core/main.cpp +++ b/core/main.cpp @@ -9,8 +9,11 @@ #include "videoelement.h" #include +#include int main(int argc, char *argv[]) { + QLoggingCategory::setFilterRules(QStringLiteral("*.verbose=false")); + QtSingleApplication app(argc, argv); app.setApplicationDisplayName("AniPlayer"); app.setApplicationName("AniPlayer3"); diff --git a/core/player.cpp b/core/player.cpp index 76c3c5c..171eeeb 100644 --- a/core/player.cpp +++ b/core/player.cpp @@ -8,7 +8,8 @@ #include #endif -Q_LOGGING_CATEGORY(playerCategory, "Player") +Q_LOGGING_CATEGORY(playerCategory, "player") +Q_LOGGING_CATEGORY(playerVerboseCategory, "player.verbose") Player::Player(BackendPluginBase *backendPlugin, QObject *parent) : QObject(parent) { @@ -266,7 +267,7 @@ void Player::playbackPositionChanged( if (qFuzzyCompare(m_position, position)) return; - qCDebug(playerCategory) << "Position changed to" << position; + qCDebug(playerVerboseCategory) << "Position changed to" << position; m_position = position; emit positionChanged(position); }