From d4f5a35e87770e597ef52c3caa89dedfe738aa8b Mon Sep 17 00:00:00 2001 From: ThorstenB Date: Sun, 3 Jul 2011 13:04:00 +0200 Subject: [PATCH] Alert message formatting. Avoid log output cluttering due to "missing animation objects". --- simgear/scene/model/animation.cxx | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/simgear/scene/model/animation.cxx b/simgear/scene/model/animation.cxx index 35113342..fa9b44e1 100644 --- a/simgear/scene/model/animation.cxx +++ b/simgear/scene/model/animation.cxx @@ -386,14 +386,24 @@ SGAnimation::SGAnimation(const SGPropertyNode* configNode, SGAnimation::~SGAnimation() { - if (_found) - return; - - SG_LOG(SG_IO, SG_ALERT, "Could not find at least one of the following" - " objects for animation:\n"); - std::list::const_iterator i; - for (i = _objectNames.begin(); i != _objectNames.end(); ++i) - SG_LOG(SG_IO, SG_ALERT, *i << "\n"); + if (!_found) + { + std::list::const_iterator i; + string info; + for (i = _objectNames.begin(); i != _objectNames.end(); ++i) + { + if (!info.empty()) + info.append(", "); + info.append("'"); + info.append(*i); + info.append("'"); + } + if (!info.empty()) + { + SG_LOG(SG_IO, SG_ALERT, "Could not find at least one of the following" + " objects for animation: " << info); + } + } } bool -- 2.39.5