[Orxonox-commit 4104] r8775 - code/branches/output/src/libraries/util

landauf at orxonox.net landauf at orxonox.net
Mon Jul 25 00:01:30 CEST 2011


Author: landauf
Date: 2011-07-25 00:01:30 +0200 (Mon, 25 Jul 2011)
New Revision: 8775

Modified:
   code/branches/output/src/libraries/util/OutputHandler.cc
Log:
fixed problem with static initialization in old implementation of the log file

Modified: code/branches/output/src/libraries/util/OutputHandler.cc
===================================================================
--- code/branches/output/src/libraries/util/OutputHandler.cc	2011-07-24 21:50:20 UTC (rev 8774)
+++ code/branches/output/src/libraries/util/OutputHandler.cc	2011-07-24 22:01:30 UTC (rev 8775)
@@ -45,9 +45,6 @@
 
 namespace orxonox
 {
-    //! How the log file shall be named on the filesystem
-    const std::string logFileBaseName_g = "orxonox.log";
-
     /////////////////////////
     ///// LogFileWriter /////
     /////////////////////////
@@ -70,12 +67,14 @@
         LogFileWriter()
             : OutputListener("LogFile")
         {
+            this->logFileBaseName_ = "orxonox.log";
+
             // Get path for a temporary file
 #ifdef ORXONOX_PLATFORM_WINDOWS
             char* pTempDir = getenv("TEMP");
-            this->logFilename_ = std::string(pTempDir) + '/' + logFileBaseName_g;
+            this->logFilename_ = std::string(pTempDir) + '/' + this->logFileBaseName_;
 #else
-            this->logFilename_ = std::string("/tmp/") + logFileBaseName_g;
+            this->logFilename_ = std::string("/tmp/") + this->logFileBaseName_;
 #endif
 
             // Get current time
@@ -109,7 +108,7 @@
                 this->logFile_.close();
 
             // Open the new file
-            this->logFilename_ = path + logFileBaseName_g;
+            this->logFilename_ = path + this->logFileBaseName_;
             this->openFile();
         }
 
@@ -137,8 +136,9 @@
             }
         }
 
-        std::ofstream logFile_;     //!< File handle for the log file
-        std::string   logFilename_; //!< Filename of the log file
+        std::ofstream logFile_;         //!< File handle for the log file
+        std::string   logFilename_;     //!< Filename of the log file
+        std::string   logFileBaseName_; //!< How the log file shall be named on the filesystem
     };
 
 




More information about the Orxonox-commit mailing list