source:
trunk/src/Logger.cpp@
1022
      
      | Last change on this file since 1022 was 894, checked in by , 20 years ago | |
|---|---|
| 
 | |
| File size: 521 bytes | |
| Rev | Line | |
|---|---|---|
| [894] | 1 | #include "Logger.h" | 
| [717] | 2 | |
| 3 | using namespace asap; | |
| 4 | ||
| [890] | 5 | std::string Logger::log_ = std::string(""); | 
| [717] | 6 | |
| [890] | 7 | Logger::Logger() | 
| [883] | 8 | { | 
| [717] | 9 | enableLog(); | 
| 10 | } | |
| 11 | ||
| [890] | 12 | Logger::Logger(bool enabled) | 
| [883] | 13 | { | 
| [717] | 14 | enabled_ = enabled; | 
| 15 | } | |
| 16 | ||
| [890] | 17 | void Logger::pushLog(const std::string& s, bool newline ) const | 
| [883] | 18 | { | 
| [717] | 19 | if (enabled_) { | 
| [883] | 20 | log_+=s; | 
| 21 | if ( newline ) log_+="\n"; | |
| 22 | }; | |
| [717] | 23 | } | 
| [890] | 24 | std::string Logger::popLog() const | 
| [717] | 25 | { | 
| [883] | 26 | std::string out; | 
| [717] | 27 | if (enabled_) out=log_;log_=""; | 
| 28 | return out; | |
| 29 | } | |
| [890] | 30 | void Logger::enableLog() | 
| [883] | 31 | { | 
| [717] | 32 | enabled_ = true; | 
| 33 | } | |
| [890] | 34 | void Logger::disableLog() | 
| [717] | 35 | { | 
| 36 | enabled_ = false; | |
| 37 | } | 
  Note:
 See   TracBrowser
 for help on using the repository browser.
    
