diff options
| author | Stefan Radomski <github@mintwerk.de> | 2017-05-04 10:15:41 (GMT) |
|---|---|---|
| committer | Stefan Radomski <github@mintwerk.de> | 2017-05-04 10:15:41 (GMT) |
| commit | 5083ea697c263a507341c98c5dadbb23953bd4fb (patch) | |
| tree | 878e0f22b5af5d8630045c786314cee9047a3c92 /src/uscxml/interpreter/Logging.cpp | |
| parent | 4e3d3d466b1a98cb40e05e54067faf7050256ed5 (diff) | |
| download | uscxml-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.cpp | 7 |
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 { |
