From a9421a9cd3539a6197d060eb1ad8d79b29d946a6 Mon Sep 17 00:00:00 2001 From: Chris Simons Date: Mon, 11 May 2020 20:36:51 -0700 Subject: [PATCH 1/2] Change log level on several status messages (Fixes #652, Fixes #516) This changes the log level for several statuses (started server, connected to server, server status:) from CLOG_NOTE or CLOG_INFO to CLOG_PRINT so they will be printed to stdout regardless of the log level. This allows the GUI to accurately report the status of the `barriers` or `barrierc` processes in src/gui/src/MainWindow.cpp#L379-L399. --- src/lib/barrier/ClientApp.cpp | 2 +- src/lib/barrier/ServerApp.cpp | 2 +- src/lib/barrier/win32/DaemonApp.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/barrier/ClientApp.cpp b/src/lib/barrier/ClientApp.cpp index a91312d8..9caf8fe4 100644 --- a/src/lib/barrier/ClientApp.cpp +++ b/src/lib/barrier/ClientApp.cpp @@ -282,7 +282,7 @@ ClientApp::scheduleClientRestart(double retryTime) void ClientApp::handleClientConnected(const Event&, void*) { - LOG((CLOG_NOTE "connected to server")); + LOG((CLOG_PRINT "connected to server")); resetRestartTimeout(); updateStatus(); } diff --git a/src/lib/barrier/ServerApp.cpp b/src/lib/barrier/ServerApp.cpp index c1cb962d..13414fc7 100644 --- a/src/lib/barrier/ServerApp.cpp +++ b/src/lib/barrier/ServerApp.cpp @@ -555,7 +555,7 @@ ServerApp::startServer() m_server->setListener(listener); m_listener = listener; updateStatus(); - LOG((CLOG_NOTE "started server (%s), waiting for clients", family)); + LOG((CLOG_PRINT "started server (%s), waiting for clients", family)); m_serverState = kStarted; return true; } diff --git a/src/lib/barrier/win32/DaemonApp.cpp b/src/lib/barrier/win32/DaemonApp.cpp index eafd8936..382a679d 100644 --- a/src/lib/barrier/win32/DaemonApp.cpp +++ b/src/lib/barrier/win32/DaemonApp.cpp @@ -353,7 +353,7 @@ DaemonApp::handleIpcMessage(const Event& e, void*) LOG((CLOG_DEBUG "ipc hello, type=%s", type.c_str())); const char * serverstatus = m_watchdog->isProcessActive() ? "active" : "not active"; - LOG((CLOG_INFO "server status: %s", serverstatus)); + LOG((CLOG_PRINT "server status: %s", serverstatus)); m_ipcLogOutputter->notifyBuffer(); break; From 5636e9cb404c63cd954aff778520c999d2da194e Mon Sep 17 00:00:00 2001 From: Ben Plessinger Date: Tue, 12 May 2020 15:49:19 -0400 Subject: [PATCH 2/2] A few more log cleanups Fix a few more log messages to be consistent --- src/gui/src/MainWindow.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/gui/src/MainWindow.cpp b/src/gui/src/MainWindow.cpp index 79faf59f..7fea19b4 100644 --- a/src/gui/src/MainWindow.cpp +++ b/src/gui/src/MainWindow.cpp @@ -345,7 +345,9 @@ void MainWindow::logError() void MainWindow::appendLogInfo(const QString& text) { - m_pLogWindow->appendInfo(text); + if (appConfig().logLevel() >= 3) { + m_pLogWindow->appendInfo(text); + } } void MainWindow::appendLogDebug(const QString& text) { @@ -536,10 +538,7 @@ void MainWindow::startBarrier() qDebug() << args; - // show command if debug log level... - if (appConfig().logLevel() >= 4) { - appendLogInfo(QString("command: %1 %2").arg(app, args.join(" "))); - } + appendLogDebug(QString("command: %1 %2").arg(app, args.join(" "))); appendLogInfo("config file: " + configFilename()); appendLogInfo("log level: " + appConfig().logLevelText());