Changeset 6004 for code/branches/console/src/libraries/util
- Timestamp:
- Oct 30, 2009, 12:39:51 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
r6000 r6004 93 93 this->outputStream_ = &this->logFile_; 94 94 // Use default level until we get the configValue from the Core 95 outputHandler.setSoftDebugLevel(this->getOutputListenerName(),OutputLevel::Debug);95 this->setSoftDebugLevel(OutputLevel::Debug); 96 96 outputHandler.registerOutputListener(this); 97 97 } … … 152 152 this->outputStream_ = &this->buffer_; 153 153 // We capture as much input as the listener with the highest level 154 outputHandler.setSoftDebugLevel(this->getOutputListenerName(),OutputHandler::getSoftDebugLevel());154 this->setSoftDebugLevel(OutputHandler::getSoftDebugLevel()); 155 155 outputHandler.registerOutputListener(this); 156 156 } 157 157 158 158 //! Pushed the just written output to the internal array 159 void outputChanged( )159 void outputChanged(int level) 160 160 { 161 161 // Read ostringstream and store it 162 this->output_.push_back(std::make_pair( OutputHandler::getInstance().getOutputLevel(), this->buffer_.str()));162 this->output_.push_back(std::make_pair(level, this->buffer_.str())); 163 163 // Clear content and flags 164 164 this->buffer_.str(std::string()); … … 210 210 } 211 211 this->listeners_.push_back(listener); 212 // Update global soft debug level 213 this->setSoftDebugLevel(listener->getOutputListenerName(), listener->getSoftDebugLevel()); 212 214 } 213 215 -
code/branches/console/src/libraries/util/OutputHandler.h
r5996 r6004 142 142 //! Returns the soft debug level for a device by its name @return The level or -1 if the listener was not found 143 143 int getSoftDebugLevel(const std::string& name) const; 144 //! Sets the soft debug level for a listener by its name 144 //! Sets the soft debug level for a listener by its name @remarks Only works for registered listeners! 145 145 void setSoftDebugLevel(const std::string& name, int level); 146 146 … … 231 231 : outputStream_(NULL) 232 232 , name_(name) 233 , softDebugLevel_(OutputLevel::Info) 233 234 {} 234 235 virtual ~OutputListener() {} 235 236 236 237 //! Gets called whenever output is put into the stream 237 virtual void outputChanged( ) {}238 virtual void outputChanged(int level) {} 238 239 //! Returns the name of this output listener 239 240 const std::string& getOutputListenerName() const { return this->name_; } 241 //! Returns the soft debug level of the listener 242 int getSoftDebugLevel() const { return this->softDebugLevel_; } 243 //! Sets the soft debug level of the listener 244 void setSoftDebugLevel(int level) 245 { 246 this->softDebugLevel_ = level; 247 OutputHandler::getInstance().setSoftDebugLevel(this->name_, level); 248 } 240 249 241 250 protected: … … 257 266 stream << output; 258 267 stream.flush(); 259 (*it)->outputChanged( );268 (*it)->outputChanged(this->outputLevel_); 260 269 } 261 270 }
Note: See TracChangeset
for help on using the changeset viewer.