diff --git a/src/blackmisc/loghandler.cpp b/src/blackmisc/loghandler.cpp index 4ce36e1e7..579ea3bf3 100644 --- a/src/blackmisc/loghandler.cpp +++ b/src/blackmisc/loghandler.cpp @@ -64,6 +64,11 @@ namespace BlackMisc } } + CLogPatternHandler *CLogHandler::handlerForCategory(const CLogCategory &category) + { + return handlerForPattern(CLogPattern::exactMatch(category)); + } + QList CLogHandler::handlersForMessage(const CStatusMessage &message) const { QList m_handlers; diff --git a/src/blackmisc/loghandler.h b/src/blackmisc/loghandler.h index 9659aec58..41b6c2797 100644 --- a/src/blackmisc/loghandler.h +++ b/src/blackmisc/loghandler.h @@ -47,6 +47,10 @@ namespace BlackMisc //! \warning This must only be called from the main thread. CLogPatternHandler *handlerForPattern(const CLogPattern &pattern); + //! Return a pattern handler for subscribing to all messages which contain the given category. + //! \warning This must only be called from the main thread. + CLogPatternHandler *handlerForCategory(const CLogCategory &category); + //! Return a pattern handler for subscribing to all validation warnings and errors. //! \warning This must only be called from the main thread. CLogPatternHandler *handlerForValidation() diff --git a/src/swiftgui_standard/main.cpp b/src/swiftgui_standard/main.cpp index 881b0548a..51d4c22bb 100644 --- a/src/swiftgui_standard/main.cpp +++ b/src/swiftgui_standard/main.cpp @@ -43,6 +43,8 @@ int main(int argc, char *argv[]) // application QApplication a(argc, argv); CLogHandler::instance()->install(); + BlackMisc::CLogHandler::instance()->handlerForCategory(CLogCategory::context())->enableConsoleOutput(false); + QIcon icon(BlackMisc::CIcons::swift24()); QApplication::setWindowIcon(icon); const QString s = CStyleSheetUtility::instance().styles(