[xswiftbus] Stop logging probe failures after a certain number

To avoid flooding the log with messages.
This commit is contained in:
Mat Sutcliffe
2020-01-19 22:16:31 +00:00
parent 90b307d868
commit 3a73933cf1
2 changed files with 12 additions and 6 deletions

View File

@@ -27,16 +27,21 @@ namespace XSwiftBus
auto result = XPLMProbeTerrainXYZ(m_ref, static_cast<float>(x), static_cast<float>(y), static_cast<float>(z), &probe);
if (result != xplm_ProbeHitTerrain)
{
std::string error;
if (result == xplm_ProbeError) { error = "probe error"; }
else if (result == xplm_ProbeMissed) { error = "probe missed"; }
else { error = "unknown probe result"; }
WARNING_LOG(callsign + " " + error + " at " + std::to_string(degreesLatitude) + ", " + std::to_string(degreesLongitude) + ", " + std::to_string(metersAltitude));
if (m_logMessageCount < 100)
{
m_logMessageCount++;
std::string error;
if (result == xplm_ProbeError) { error = "probe error"; }
else if (result == xplm_ProbeMissed) { error = "probe missed"; }
else { error = "unknown probe result"; }
WARNING_LOG(callsign + " " + error + " at " + std::to_string(degreesLatitude) + ", " + std::to_string(degreesLongitude) + ", " + std::to_string(metersAltitude));
}
return std::numeric_limits<double>::quiet_NaN();
}
if (probe.is_wet)
if (probe.is_wet && m_logMessageCount < 100)
{
m_logMessageCount++;
DEBUG_LOG(callsign + " probe hit water at " + std::to_string(degreesLatitude) + ", " + std::to_string(degreesLongitude) + ", " + std::to_string(metersAltitude));
}