summaryrefslogtreecommitdiffstats
path: root/src/uscxml/interpreter/Logging.cpp
diff options
context:
space:
mode:
authorStefan Radomski <github@mintwerk.de>2017-05-04 10:15:41 (GMT)
committerStefan Radomski <github@mintwerk.de>2017-05-04 10:15:41 (GMT)
commit5083ea697c263a507341c98c5dadbb23953bd4fb (patch)
tree878e0f22b5af5d8630045c786314cee9047a3c92 /src/uscxml/interpreter/Logging.cpp
parent4e3d3d466b1a98cb40e05e54067faf7050256ed5 (diff)
downloaduscxml-5083ea697c263a507341c98c5dadbb23953bd4fb.zip
uscxml-5083ea697c263a507341c98c5dadbb23953bd4fb.tar.gz
uscxml-5083ea697c263a507341c98c5dadbb23953bd4fb.tar.bz2
Actually fixed issue 113
Diffstat (limited to 'src/uscxml/interpreter/Logging.cpp')
-rw-r--r--src/uscxml/interpreter/Logging.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/uscxml/interpreter/Logging.cpp b/src/uscxml/interpreter/Logging.cpp
index 0b3caac..29fc0a0 100644
--- a/src/uscxml/interpreter/Logging.cpp
+++ b/src/uscxml/interpreter/Logging.cpp
@@ -58,11 +58,16 @@ void Logger::log(LogSeverity severity, const std::string& message) {
}
StreamLogger Logger::log(LogSeverity severity) {
+ // older c++ compilers will invoke the copy constructor and destructor here!
return StreamLogger(severity, _impl);
}
StreamLogger::~StreamLogger() {
- _logger->log(_severity, ss.str());
+ ss.seekg(0, std::ios::end);
+ // only log if there is something in the string to solve issue with destructor being called twice
+ if (ss.tellg() > 0) {
+ _logger->log(_severity, ss.str());
+ }
}
std::shared_ptr<LoggerImpl> Logger::getImpl() const {