- Timestamp:
- Jul 30, 2011, 7:51:08 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/output/src/libraries/util/output/BaseWriter.cc
r8795 r8799 33 33 namespace orxonox 34 34 { 35 BaseWriter::BaseWriter( )35 BaseWriter::BaseWriter(const std::string& name) 36 36 { 37 this->name_ = name; 38 39 this->configurableMaxLevel_ = level::none; 40 this->configurableContextsMaxLevel_ = level::verbose; 37 41 } 38 42 … … 43 47 void BaseWriter::output(OutputLevel level, OutputContext context, const std::vector<std::string>& lines) 44 48 { 45 const std::string& prefix = OutputManager::getInstance().getDefaultPrefix(level, context); 46 std::string blanks(prefix.length(), ' '); 49 if (level <= this->configurableMaxLevel_ || (level <= this->configurableContextsMaxLevel_ && this->isAdditionalContext(context))) 50 { 51 const std::string& prefix = OutputManager::getInstance().getDefaultPrefix(level, context); 52 std::string blanks(prefix.length(), ' '); 47 53 48 for (size_t i = 0; i < lines.size(); ++i) 49 this->printLine((i == 0 ? prefix : blanks) + lines[i], level); 54 for (size_t i = 0; i < lines.size(); ++i) 55 this->printLine((i == 0 ? prefix : blanks) + lines[i], level); 56 } 57 } 58 59 void BaseWriter::setLevelMax(OutputLevel max) 60 { 61 this->configurableMaxLevel_ = max; 62 this->changedConfigurableLevels(); 63 } 64 65 void BaseWriter::changedConfigurableLevels() 66 { 67 OutputLevel max_level = std::max(this->configurableMaxLevel_, this->configurableContextsMaxLevel_); 68 OutputListener::setLevelMax(max_level); 69 } 70 71 void BaseWriter::changedConfigurableContexts() 72 { 73 this->configurableContextsSet_.clear(); 74 for (size_t i = 0; i < this->configurableContexts_.size(); ++i) 75 this->configurableContextsSet_.insert(this->configurableContexts_[i]); 76 } 77 78 bool BaseWriter::isAdditionalContext(OutputContext context) const 79 { 80 const std::string& name = OutputManager::getInstance().getContextName(context); 81 std::set<std::string>::const_iterator it = this->configurableContextsSet_.find(name); 82 return (it != this->configurableContextsSet_.end()); 50 83 } 51 84 }
Note: See TracChangeset
for help on using the changeset viewer.