[MERGED] osmo-trx[master]: Logger: Drop support to log into file

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Wed Feb 21 12:00:14 UTC 2018


Harald Welte has submitted this change and it was merged.

Change subject: Logger: Drop support to log into file
......................................................................


Logger: Drop support to log into file

This feature is currently not being used, so let's simplify current code
to move to libosmocore logging system in the future.

Change-Id: If2c77c776823f595130edac963be953026049423
---
M CommonLibs/Logger.cpp
1 file changed, 1 insertion(+), 19 deletions(-)

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



diff --git a/CommonLibs/Logger.cpp b/CommonLibs/Logger.cpp
index 2cdd158..b05e7fd 100644
--- a/CommonLibs/Logger.cpp
+++ b/CommonLibs/Logger.cpp
@@ -39,7 +39,6 @@
 
 // Switches to enable/disable logging targets
 bool gLogToConsole = true;
-FILE *gLogToFile = NULL;
 Mutex gLogToLock;
 
 // Global log level threshold:
@@ -103,7 +102,7 @@
 		cerr << mStream.str() << endl;
 	}
 	// Log to file and console
-	if (gLogToConsole||gLogToFile) {
+	if (gLogToConsole) {
 		int mlen = mStream.str().size();
 		int neednl = (mlen==0 || mStream.str()[mlen-1] != '\n');
 		ScopedLock lock(gLogToLock);
@@ -112,11 +111,6 @@
 			// so just use std::cout.
 			std::cout << mStream.str();
 			if (neednl) std::cout<<"\n";
-		}
-		if (gLogToFile) {
-			fputs(mStream.str().c_str(),gLogToFile);
-			if (neednl) {fputc('\n',gLogToFile);}
-			fflush(gLogToFile);
 		}
 	}
 }
@@ -135,18 +129,6 @@
 	// Set the level if one has been specified.
 	if (level)
 		config_log_level = levelStringToInt(level);
-
-	// Both the transceiver and OpenBTS use this same facility, but only OpenBTS/OpenNodeB may use this log file:
-	if (!gLogToFile && fn) {
-		gLogToFile = fopen(fn,"w"); // New log file each time we start.
-		if (gLogToFile) {
-			time_t now;
-			time(&now);
-			fprintf(gLogToFile,"Starting at %s",ctime(&now));
-			fflush(gLogToFile);
-			std::cout << "Logging to file: " << fn << "\n";
-		}
-	}
 }
 
 // vim: ts=4 sw=4

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

Gerrit-MessageType: merged
Gerrit-Change-Id: If2c77c776823f595130edac963be953026049423
Gerrit-PatchSet: 2
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list