From e78205f071ea098797ea9c4c3793bfae6c414a23 Mon Sep 17 00:00:00 2001 From: Julian Smith Date: Sun, 29 Dec 2019 18:56:29 +0000 Subject: [PATCH] simgear/debug/logstream.cxx: Fixed FileLogCallback to not output :-1. logstream::LogStreamPrivate::log() sets line=-1 to turn off both filename and line numbers in log output, if m_fileLine is false. StderrLogCallback::operator() already omits both file and line if line == -1; this commit does the same thing for FileLogCallback::operator(). E.g. this fixes output e.g. to ~/.fgfs/fgfs.log. --- simgear/debug/logstream.cxx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/simgear/debug/logstream.cxx b/simgear/debug/logstream.cxx index f2c61531..952eba16 100644 --- a/simgear/debug/logstream.cxx +++ b/simgear/debug/logstream.cxx @@ -158,11 +158,16 @@ public: << std::setw(10) << std::left << debugClassToString(c) - << " " - << file - << ":" - << line - << ":" + ; + if (file && line != -1) { + m_file + << file + << ":" + << line + << ": " + ; + } + m_file << message << std::endl; //m_file << debugClassToString(c) << ":" << (int)p // << ":" << file << ":" << line << ":" << message << std::endl;