From 67422eea3610f4578debcd475e13a8aabf1e240e Mon Sep 17 00:00:00 2001 From: cvhere <135428127+cvhere@users.noreply.github.com> Date: Tue, 31 Oct 2023 11:14:23 +0530 Subject: [PATCH] Skips logging NoActivePlayer error msgs --- src/modules/mpris/mpris.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/modules/mpris/mpris.cpp b/src/modules/mpris/mpris.cpp index feb1f60f..cd69c336 100644 --- a/src/modules/mpris/mpris.cpp +++ b/src/modules/mpris/mpris.cpp @@ -574,7 +574,13 @@ auto Mpris::getPlayerInfo() -> std::optional { return info; errorexit: - spdlog::error("mpris[{}]: {}", info.name, error->message); + std::string errorMsg = error->message; + // When mpris checks for active player sessions periodically(5 secs), NoActivePlayer error message is + // thrown when there are no active sessions. This error message is spamming logs without having any value + // addition. Log the error only if the error we recceived is not NoActivePlayer. + if(errorMsg.rfind("GDBus.Error:com.github.altdesktop.playerctld.NoActivePlayer") == std::string::npos){ + spdlog::error("mpris[{}]: {}", info.name, error->message); + } return std::nullopt; }