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