source:
trunk/src/Logger.cpp@
2102
Last change on this file since 2102 was 1030, checked in by , 19 years ago | |
---|---|
|
|
File size: 543 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 | } | |
[1030] | 16 | Logger::~Logger() |
17 | { | |
18 | } | |
[717] | 19 | |
[890] | 20 | void Logger::pushLog(const std::string& s, bool newline ) const |
[883] | 21 | { |
[717] | 22 | if (enabled_) { |
[883] | 23 | log_+=s; |
24 | if ( newline ) log_+="\n"; | |
25 | }; | |
[717] | 26 | } |
[890] | 27 | std::string Logger::popLog() const |
[717] | 28 | { |
[883] | 29 | std::string out; |
[717] | 30 | if (enabled_) out=log_;log_=""; |
31 | return out; | |
32 | } | |
[890] | 33 | void Logger::enableLog() |
[883] | 34 | { |
[717] | 35 | enabled_ = true; |
36 | } | |
[890] | 37 | void Logger::disableLog() |
[717] | 38 | { |
39 | enabled_ = false; | |
40 | } |
Note:
See TracBrowser
for help on using the repository browser.