Changeset 6015 for code/branches/console/src/libraries/util
- Timestamp:
- Nov 2, 2009, 5:54:13 PM (15 years ago)
- Location:
- code/branches/console/src/libraries/util
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/console/src/libraries/util/OutputHandler.cc
r6007 r6015 118 118 std::ofstream logFile_; //! File handle for the log file 119 119 std::string logFilename_; //! Filename of the log file 120 }; 121 122 123 ///////////////////////// 124 ///// ConsoleWriter ///// 125 ///////////////////////// 126 /** 127 @brief 128 Writes the output to std::cout. 129 @note 130 This listener will usually be disable once an actual shell with console is instantiated. 131 */ 132 class ConsoleWriter : public OutputListener 133 { 134 public: 135 //! Only assigns the output stream with std::cout 136 ConsoleWriter() 137 : OutputListener("consoleLog") 138 { 139 this->outputStream_ = &std::cout; 140 } 120 141 }; 121 142 … … 176 197 : outputLevel_(OutputLevel::Verbose) 177 198 { 199 #ifdef ORXONOX_RELEASE 200 const OutputLevel::Value defaultLevelConsole = OutputLevel::Error; 201 const OutputLevel::Value defaultLevelLogFile = OutputLevel::Info; 202 #else 203 const OutputLevel::Value defaultLevelConsole = OutputLevel::Info; 204 const OutputLevel::Value defaultLevelLogFile = OutputLevel::Debug; 205 #endif 206 178 207 this->logFile_ = new LogFileWriter(); 179 208 // Use default level until we get the configValue from the Core 180 this->logFile_->softDebugLevel_ = OutputLevel::Debug;209 this->logFile_->softDebugLevel_ = defaultLevelLogFile; 181 210 this->registerOutputListener(this->logFile_); 211 212 this->consoleWriter_ = new ConsoleWriter(); 213 this->consoleWriter_->softDebugLevel_ = defaultLevelConsole; 214 this->registerOutputListener(this->consoleWriter_); 182 215 183 216 this->output_ = new MemoryLogWriter(); … … 225 258 } 226 259 260 void OutputHandler::disableCout() 261 { 262 this->unregisterOutputListener(this->consoleWriter_); 263 } 264 265 void OutputHandler::enableCout() 266 { 267 this->registerOutputListener(this->consoleWriter_); 268 } 269 227 270 OutputHandler::OutputVectorIterator OutputHandler::getOutputVectorBegin() const 228 271 { -
code/branches/console/src/libraries/util/OutputHandler.h
r6004 r6015 74 74 // Forward declarations for classes in the source file 75 75 class LogFileWriter; 76 class ConsoleWriter; 76 77 class MemoryLogWriter; 77 78 … … 129 130 //! Set the log path once the program has been properly initialised 130 131 void setLogPath(const std::string& path); 132 //! Disables the std::cout stream for output 133 void disableCout(); 134 //! Enables the std::cout stream for output (startup behaviour) 135 void enableCout(); 131 136 132 137 //! Sets the level of the incoming output and returns the OutputHandler … … 210 215 OutputHandler(const OutputHandler& rhs); //! Unused and undefined 211 216 212 std::list<OutputListener*> listeners_; //!< Array with all registered output listeners 213 int outputLevel_; //!< The level of the incoming output 214 LogFileWriter* logFile_; //!< Listener that writes to the log file 215 MemoryLogWriter* output_; //!< Listener that Stores ALL output below the current soft debug level 216 static int softDebugLevel_s; //!< Maximum of all soft debug levels. @note This is only static for faster access 217 std::list<OutputListener*> listeners_; //!< Array with all registered output listeners 218 int outputLevel_; //!< The level of the incoming output 219 LogFileWriter* logFile_; //!< Listener that writes to the log file 220 ConsoleWriter* consoleWriter_; //!< Listener for std::cout (just program beginning) 221 MemoryLogWriter* output_; //!< Listener that Stores ALL output below the current soft debug level 222 static int softDebugLevel_s; //!< Maximum of all soft debug levels. @note This is only static for faster access 217 223 }; 218 224
Note: See TracChangeset
for help on using the changeset viewer.