From c136b317910e2de8ff8d344c8c51ba7d005075ea Mon Sep 17 00:00:00 2001 From: James Turner Date: Fri, 15 Oct 2021 12:14:01 +0100 Subject: [PATCH] Updated for revised SGMetar API --- src/Environment/fgmetar.cxx | 6 +++--- src/Environment/metarproperties.cxx | 2 +- src/Environment/realwx_ctrl.cxx | 5 +++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Environment/fgmetar.cxx b/src/Environment/fgmetar.cxx index 221e77305..d0f6ead35 100644 --- a/src/Environment/fgmetar.cxx +++ b/src/Environment/fgmetar.cxx @@ -151,11 +151,11 @@ FGMetar::FGMetar(const string& icao) : _time = sgTimeGetGMT(_year - 1900, _month - 1, _day, _hour, _minute, 0); - SG_LOG(SG_ENVIRONMENT, SG_INFO, _data); + SG_LOG(SG_ENVIRONMENT, SG_DEBUG, "FGMetar:" << getRawDataPtr()); if (_x_proxy) - SG_LOG(SG_ENVIRONMENT, SG_INFO, "METAR from proxy"); + SG_LOG(SG_ENVIRONMENT, SG_DEBUG, "METAR from proxy"); else - SG_LOG(SG_ENVIRONMENT, SG_INFO, "METAR from tgftp.nws.noaa.gov"); + SG_LOG(SG_ENVIRONMENT, SG_DEBUG, "METAR from tgftp.nws.noaa.gov"); } diff --git a/src/Environment/metarproperties.cxx b/src/Environment/metarproperties.cxx index 568532bbb..94698cb21 100644 --- a/src/Environment/metarproperties.cxx +++ b/src/Environment/metarproperties.cxx @@ -205,7 +205,7 @@ static const double thickness_value[] = { 0, 65, 600, 750, 1000 }; const char* MetarProperties::get_metar() const { if (!_metar) return ""; - return _metar->getData(); + return _metar->getRawDataPtr(); } void MetarProperties::set_metar( const char * metarString ) diff --git a/src/Environment/realwx_ctrl.cxx b/src/Environment/realwx_ctrl.cxx index 6cf7cc662..f4e9bb4dc 100644 --- a/src/Environment/realwx_ctrl.cxx +++ b/src/Environment/realwx_ctrl.cxx @@ -128,8 +128,9 @@ void LiveMetarProperties::handleMetarData( const std::string & data ) try { m = new FGMetar(data.c_str()); } - catch( sg_io_exception &) { - SG_LOG( SG_ENVIRONMENT, SG_WARN, "Can't parse metar: " << data ); + catch( sg_io_exception &e) { + SG_LOG( SG_ENVIRONMENT, SG_WARN, "Can't parse metar: " << data << + " (" << e.getFormattedMessage() << ")"); // ensure we only report one METAR parse failure per session if (!haveReportedMETARFailure) {