Move logging from QDebug to QCDebug and introduce LoggingCategories. (#5491)

* Move logging from QDebug to QCDebug and introduce LoggingCategories.

* Lint.

* Unlint like one change.

* Remove .debug category since this is autofilled by Qt and used to differentiate between QCDebug and QCWarning and QCError.

* Uncomment defaults, include main category.

* Make PictureLoader logging a bit more useful.

* Lint...?

* Address comments.

* Clean up some unnecessary classes in logging statements.

* Add a new message format to the logging handler.

* Lint.

* Lint.

* Support Windows in Regex

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
Co-authored-by: ZeldaZach <zahalpern+github@gmail.com>
This commit is contained in:
BruebachL 2025-01-19 14:14:23 +01:00 committed by GitHub
parent e752578d15
commit aa24502129
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
63 changed files with 316 additions and 162 deletions

View file

@ -1578,12 +1578,10 @@ void TabDeckEditor::actDecrement()
void TabDeckEditor::setDeck(DeckLoader *_deck)
{
qDebug() << " ORIGINAL BANNER CARD " << _deck->getBannerCard().first;
deckModel->setDeckList(_deck);
nameEdit->setText(deckModel->getDeckList()->getName());
commentsEdit->setText(deckModel->getDeckList()->getComments());
qDebug() << deckModel->getDeckList()->getBannerCard() << " was the banner card";
bannerCardComboBox->setCurrentText(deckModel->getDeckList()->getBannerCard().first);
updateBannerCardComboBox();
updateHash();

View file

@ -760,7 +760,7 @@ void TabGame::processGameEventContainer(const GameEventContainer &cont,
default: {
Player *player = players.value(playerId, 0);
if (!player) {
qDebug() << "unhandled game event: invalid player id";
qCDebug(TabGameLog) << "unhandled game event: invalid player id";
break;
}
player->processGameEvent(eventType, event, context, options);

View file

@ -9,8 +9,11 @@
#include "tab.h"
#include <QCompleter>
#include <QLoggingCategory>
#include <QMap>
inline Q_LOGGING_CATEGORY(TabGameLog, "tab_game");
class UserListProxy;
class DeckViewContainer;
class AbstractClient;

View file

@ -148,7 +148,7 @@ void TabMessage::showSystemPopup(const Event_UserMessage &event)
event.message().c_str());
connect(trayIcon, SIGNAL(messageClicked()), this, SLOT(messageClicked()));
} else {
qDebug() << "Error: trayIcon is NULL. TabMessage::showSystemPopup failed";
qCDebug(TabMessageLog) << "Error: trayIcon is NULL. TabMessage::showSystemPopup failed";
}
}

View file

@ -3,6 +3,10 @@
#include "tab.h"
#include <QLoggingCategory>
inline Q_LOGGING_CATEGORY(TabMessageLog, "tab_message");
class AbstractClient;
class ChatView;
class LineEditUnfocusable;

View file

@ -760,7 +760,7 @@ void TabSupervisor::processGameEventContainer(const GameEventContainer &cont)
if (tab)
tab->processGameEventContainer(cont, qobject_cast<AbstractClient *>(sender()), {});
else
qDebug() << "gameEvent: invalid gameId";
qCDebug(TabSupervisorLog) << "gameEvent: invalid gameId";
}
void TabSupervisor::processUserMessageEvent(const Event_UserMessage &event)
@ -787,9 +787,9 @@ void TabSupervisor::processUserMessageEvent(const Event_UserMessage &event)
void TabSupervisor::actShowPopup(const QString &message)
{
qDebug() << "ACT SHOW POPUP";
qCDebug(TabSupervisorLog) << "ACT SHOW POPUP";
if (trayIcon && (QApplication::activeWindow() == nullptr || QApplication::focusWidget() == nullptr)) {
qDebug() << "LAUNCHING POPUP";
qCDebug(TabSupervisorLog) << "LAUNCHING POPUP";
// disconnect(trayIcon, SIGNAL(messageClicked()), nullptr, nullptr);
trayIcon->showMessage(message, tr("Click to view"));
// connect(trayIcon, SIGNAL(messageClicked()), chatView, SLOT(actMessageClicked()));

View file

@ -7,10 +7,13 @@
#include <QAbstractButton>
#include <QCommonStyle>
#include <QLoggingCategory>
#include <QMap>
#include <QProxyStyle>
#include <QTabWidget>
inline Q_LOGGING_CATEGORY(TabSupervisorLog, "tab_supervisor");
class UserListManager;
class QMenu;
class AbstractClient;