From: James Turner Date: Sun, 10 Feb 2013 11:47:16 +0000 (+0000) Subject: FlightRecorder: smarter log warning. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=d9159e719ddacac12f518ca1a4004ab31ea81c9d;p=flightgear.git FlightRecorder: smarter log warning. When using the default (generic) config, which references many props which may not exist in a particular aircraft, suppress the 'recording non-existent' property warning. --- diff --git a/src/Aircraft/flightrecorder.cxx b/src/Aircraft/flightrecorder.cxx index 5e37b2c36..34a03c18d 100644 --- a/src/Aircraft/flightrecorder.cxx +++ b/src/Aircraft/flightrecorder.cxx @@ -43,7 +43,8 @@ using std::string; FGFlightRecorder::FGFlightRecorder(const char* pConfigName) : m_RecorderNode(fgGetNode("/sim/flight-recorder", true)), m_TotalRecordSize(0), - m_ConfigName(pConfigName) + m_ConfigName(pConfigName), + m_usingDefaultConfig(false) { } @@ -55,6 +56,7 @@ void FGFlightRecorder::reinit(void) { m_ConfigNode = 0; + m_usingDefaultConfig = false; SGPropertyNode_ptr ConfigNode; int Selected = m_RecorderNode->getIntValue(m_ConfigName, 0); @@ -188,6 +190,7 @@ FGFlightRecorder::getDefault(void) } } + m_usingDefaultConfig = true; return ConfigNode; } @@ -254,9 +257,15 @@ FGFlightRecorder::processSignalList(const char* pSignalType, TSignalList& Signal Capture.Signal = fgGetNode(PPath.c_str(),false); if (!Capture.Signal.valid()) { - // warn user: we're maybe going to record useless data - // Or maybe the data is only initialized later. Warn anyway, so we can catch useless data. - SG_LOG(SG_SYSTEMS, SG_INFO, "FlightRecorder: Recording non-existent property '" << PPath << "'."); + // JMT - only warn if using a custom config, not the default one. Since the generic config of + // course requests many props, but we do want this warning for custom configs tailored to the + // aircraft model. + if (!m_usingDefaultConfig) { + // warn user: we're maybe going to record useless data + // Or maybe the data is only initialized later. Warn anyway, so we can catch useless data. + SG_LOG(SG_SYSTEMS, SG_INFO, "FlightRecorder: Recording non-existent property '" << PPath << "'."); + } + Capture.Signal = fgGetNode(PPath.c_str(),true); } diff --git a/src/Aircraft/flightrecorder.hxx b/src/Aircraft/flightrecorder.hxx index 3fddc11b3..f3759df64 100644 --- a/src/Aircraft/flightrecorder.hxx +++ b/src/Aircraft/flightrecorder.hxx @@ -88,6 +88,7 @@ private: int m_TotalRecordSize; std::string m_ConfigName; + bool m_usingDefaultConfig; }; #endif /* FLIGHTRECORDER_HXX_ */