diff --git a/src/Main/main.cxx b/src/Main/main.cxx index b30568dda..41f43cd8a 100755 --- a/src/Main/main.cxx +++ b/src/Main/main.cxx @@ -48,6 +48,7 @@ #include #include #include +#include #include #include @@ -548,6 +549,17 @@ static void logToHome(const std::string& pri) sglog().logToFile(logPath, SG_ALL, fileLogLevel); } +struct SGLogDeltasListener : SGPropertyChangeListener +{ + void valueChanged(SGPropertyNode* node) override + { + const char* value = node->getStringValue(); + std::cerr << __FILE__ << ":" << __LINE__ << ": sglogdeltas value=" << value << "\n"; + logDeltaSet(value); + } +}; +static SGLogDeltasListener s_sglogdeltas_listener; + // Main top level initialization int fgMainInit( int argc, char **argv ) { @@ -588,6 +600,16 @@ int fgMainInit( int argc, char **argv ) } #endif + { + SGPropertyNode* sglogdeltas = globals->get_props()->getNode("/sim/sg-log-deltas", true /*create*/); + assert(sglogdeltas); + sglogdeltas->addChangeListener(&s_sglogdeltas_listener, false /*initial*/); + const char* sglogdeltas_value = getenv("SG_LOG_DELTAS"); + if (sglogdeltas_value) { + sglogdeltas->setStringValue(sglogdeltas_value); + } + } + const bool readOnlyFGHome = fgGetBool("/sim/fghome-readonly"); if (!readOnlyFGHome) { // now home is initialised, we can log to a file inside it