Changeset 2685 for code/branches/buildsystem3/src/util
- Timestamp:
- Feb 20, 2009, 5:32:04 PM (16 years ago)
- Location:
- code/branches/buildsystem3/src/util
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/buildsystem3/src/util/OutputBuffer.cc
r2171 r2685 68 68 OutputBuffer& OutputBuffer::operator<<(std::ostream& (*manipulator)(std::ostream&)) 69 69 { 70 71 72 70 this->stream_ << manipulator; 71 this->callListeners(); 72 return *this; 73 73 } 74 74 … … 79 79 OutputBuffer& OutputBuffer::operator<<(std::ios& (*manipulator)(std::ios&)) 80 80 { 81 82 83 81 this->stream_ << manipulator; 82 this->callListeners(); 83 return *this; 84 84 } 85 85 … … 90 90 OutputBuffer& OutputBuffer::operator<<(std::ios_base& (*manipulator)(std::ios_base&)) 91 91 { 92 93 94 92 this->stream_ << manipulator; 93 this->callListeners(); 94 return *this; 95 95 } 96 96 -
code/branches/buildsystem3/src/util/OutputHandler.cc
r2662 r2685 33 33 34 34 #include "OutputHandler.h" 35 #include <time.h> 35 36 #include <ctime> 37 #include <cstdlib> 36 38 37 39 namespace orxonox … … 41 43 @param logfilename The name of the logfile 42 44 */ 43 OutputHandler::OutputHandler(const std::string& logfilename) 44 { 45 OutputHandler::OutputHandler() 46 { 47 #ifdef ORXONOX_PLATFORM_WINDOWS 48 char* pTempDir = getenv("TEMP"); 49 this->logfilename_ = std::string(pTempDir) + "/orxonox.log"; 50 #else 51 this->logfilename_ = "/tmp/orxonox.log"; 52 #endif 53 #ifdef NDEBUG 54 this->softDebugLevel_[LD_All] = this->softDebugLevel_[LD_Logfile] = 2; 55 this->softDebugLevel_[LD_Console] = this->softDebugLevel_[LD_Shell] = 1; 56 #else 57 this->softDebugLevel_[LD_All] = this->softDebugLevel_[LD_Logfile] = 3; 58 this->softDebugLevel_[LD_Console] = this->softDebugLevel_[LD_Shell] = 2; 59 #endif 60 45 61 this->outputBuffer_ = &this->fallbackBuffer_; 46 this->softDebugLevel_[0] = this->softDebugLevel_[1] = this->softDebugLevel_[2] = this->softDebugLevel_[3] = 2;47 this->logfilename_ = logfilename;48 62 this->logfile_.open(this->logfilename_.c_str(), std::fstream::out); 49 63 … … 53 67 timeinfo = localtime(&rawtime); 54 68 55 this->logfile_ << "Started log at" << asctime(timeinfo) << std::endl;69 this->logfile_ << "Started log on " << asctime(timeinfo) << std::endl; 56 70 this->logfile_.flush(); 57 71 } … … 72 86 OutputHandler& OutputHandler::getOutStream() 73 87 { 74 static OutputHandler orxout ("orxonox.log");88 static OutputHandler orxout; 75 89 return orxout; 76 90 } … … 112 126 113 127 /** 128 @brief Sets the path where to create orxonox.log 129 @param Path string with trailing slash 130 */ 131 void OutputHandler::setLogPath(const std::string& path) 132 { 133 OutputHandler::getOutStream().logfile_.close(); 134 // store old content 135 std::ifstream old; 136 old.open(OutputHandler::getOutStream().logfilename_.c_str()); 137 OutputHandler::getOutStream().logfilename_ = path + "orxonox.log"; 138 OutputHandler::getOutStream().logfile_.open(OutputHandler::getOutStream().logfilename_.c_str(), std::fstream::out); 139 OutputHandler::getOutStream().logfile_ << old.rdbuf(); 140 old.close(); 141 OutputHandler::getOutStream().logfile_.flush(); 142 } 143 144 /** 114 145 @brief Overloaded << operator, redirects the output to the console and the logfile. 115 146 @param sb The streambuffer that should be shown in the console -
code/branches/buildsystem3/src/util/OutputHandler.h
r2662 r2685 101 101 static int getSoftDebugLevel(OutputHandler::OutputDevice device = OutputHandler::LD_All); 102 102 103 static void setLogPath(const std::string& path); 104 103 105 void setOutputBuffer(OutputBuffer* buffer); 104 106 … … 142 144 143 145 private: 144 explicit OutputHandler( const std::string& logfilename);145 OutputHandler(const OutputHandler& oh); // don't copy146 explicit OutputHandler(); 147 OutputHandler(const OutputHandler& oh); 146 148 virtual ~OutputHandler(); 147 149 -
code/branches/buildsystem3/src/util/SignalHandler.cc
r2664 r2685 159 159 } 160 160 161 COUT(0) << "recieved signal " << sigName.c_str() << std::endl << "try to write backtrace to file orxonox .log" << std::endl;161 COUT(0) << "recieved signal " << sigName.c_str() << std::endl << "try to write backtrace to file orxonox_crash.log" << std::endl; 162 162 163 163 int sigPipe[2];
Note: See TracChangeset
for help on using the changeset viewer.