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