Harald Welte has submitted this change and it was merged.

Change subject: Logger: Remove gLogToConsole flag
......................................................................


Logger: Remove gLogToConsole flag

No code is using it and we always lock to console anyways.

Change-Id: I5fde99c6af5a845e635b5d27abab855682071f14
---
M CommonLibs/Logger.cpp
M CommonLibs/Logger.h
2 files changed, 8 insertions(+), 15 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/CommonLibs/Logger.cpp b/CommonLibs/Logger.cpp
index b05e7fd..4c2a2d3 100644
--- a/CommonLibs/Logger.cpp
+++ b/CommonLibs/Logger.cpp
@@ -37,8 +37,6 @@
 
 using namespace std;
 
-// Switches to enable/disable logging targets
-bool gLogToConsole = true;
 Mutex gLogToLock;
 
 // Global log level threshold:
@@ -101,18 +99,14 @@
        if (mPriority <= LOG_ERR) {
                cerr << mStream.str() << endl;
        }
-       // Log to file and console
-       if (gLogToConsole) {
-               int mlen = mStream.str().size();
-               int neednl = (mlen==0 || mStream.str()[mlen-1] != '\n');
-               ScopedLock lock(gLogToLock);
-               if (gLogToConsole) {
-                       // The COUT() macro prevents messages from stomping 
each other but adds uninteresting thread numbers,
-                       // so just use std::cout.
-                       std::cout << mStream.str();
-                       if (neednl) std::cout<<"\n";
-               }
-       }
+
+       int mlen = mStream.str().size();
+       int neednl = (mlen==0 || mStream.str()[mlen-1] != '\n');
+       ScopedLock lock(gLogToLock);
+       // The COUT() macro prevents messages from stomping each other but adds 
uninteresting thread numbers,
+       // so just use std::cout.
+       std::cout << mStream.str();
+       if (neednl) std::cout<<"\n";
 }
 
 ostringstream& Log::get()
diff --git a/CommonLibs/Logger.h b/CommonLibs/Logger.h
index 32ee891..a8fe44d 100644
--- a/CommonLibs/Logger.h
+++ b/CommonLibs/Logger.h
@@ -88,7 +88,6 @@
 
        std::ostringstream& get();
 };
-extern bool gLogToConsole;     // Output log messages to stdout
 
 const std::string timestr();           // A timestamp to print in messages.
 std::ostream& operator<<(std::ostream& os, std::ostringstream& ss);

-- 
To view, visit https://gerrit.osmocom.org/6616
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I5fde99c6af5a845e635b5d27abab855682071f14
Gerrit-PatchSet: 2
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pes...@sysmocom.de>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder

Reply via email to