diff --git a/fpsdk_common/src/logging.cpp b/fpsdk_common/src/logging.cpp index 123c609..5ea4983 100644 --- a/fpsdk_common/src/logging.cpp +++ b/fpsdk_common/src/logging.cpp @@ -370,18 +370,18 @@ LoggingOstream::LoggingOstream(const LoggingLevel level) : str_{ &buf_ } int LoggingOstream::StrBuf::sync() { // Print each line - const auto s = this->str(); + const auto& s = this->str(); std::size_t offs = 0; std::size_t pos = 0; while ((pos = s.find("\n", offs)) != std::string::npos) { switch (level_) { // clang-format off - case LoggingLevel::FATAL: FATAL( "%s", s.substr(offs, pos).c_str()); break; - case LoggingLevel::ERROR: ERROR( "%s", s.substr(offs, pos).c_str()); break; - case LoggingLevel::WARNING: WARNING("%s", s.substr(offs, pos).c_str()); break; - case LoggingLevel::NOTICE: NOTICE( "%s", s.substr(offs, pos).c_str()); break; - case LoggingLevel::INFO: INFO( "%s", s.substr(offs, pos).c_str()); break; - case LoggingLevel::DEBUG: DEBUG( "%s", s.substr(offs, pos).c_str()); break; - case LoggingLevel::TRACE: TRACE( "%s", s.substr(offs, pos).c_str()); break; + case LoggingLevel::FATAL: FATAL( "%s", s.substr(offs, pos - offs).c_str()); break; + case LoggingLevel::ERROR: ERROR( "%s", s.substr(offs, pos - offs).c_str()); break; + case LoggingLevel::WARNING: WARNING("%s", s.substr(offs, pos - offs).c_str()); break; + case LoggingLevel::NOTICE: NOTICE( "%s", s.substr(offs, pos - offs).c_str()); break; + case LoggingLevel::INFO: INFO( "%s", s.substr(offs, pos - offs).c_str()); break; + case LoggingLevel::DEBUG: DEBUG( "%s", s.substr(offs, pos - offs).c_str()); break; + case LoggingLevel::TRACE: TRACE( "%s", s.substr(offs, pos - offs).c_str()); break; } // clang-format on offs = pos + 1; }