From 5083ea697c263a507341c98c5dadbb23953bd4fb Mon Sep 17 00:00:00 2001 From: Stefan Radomski Date: Thu, 4 May 2017 12:15:41 +0200 Subject: Actually fixed issue 113 --- src/uscxml/interpreter/Logging.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 Logger::getImpl() const { -- cgit v0.12