From 458edb933903836ac10b2acd9ef68e06e2a04470 Mon Sep 17 00:00:00 2001 From: ThorstenB Date: Fri, 23 Nov 2012 21:14:40 +0100 Subject: [PATCH] Use more specific logging classes for SG_LOG. The log filters aren't really useful when everything uses SG_GENERAL. --- src/Main/fg_props.cxx | 1 + src/Navaids/FlightPlan.cxx | 26 +++++++++++++------------- src/Navaids/LevelDXML.cxx | 6 +++--- src/Navaids/NavDataCache.cxx | 6 +++--- src/Navaids/airways.cxx | 20 ++++++++++---------- src/Navaids/awynet.cxx | 6 +++--- src/Navaids/fixlist.cxx | 2 +- src/Navaids/navdb.cxx | 14 +++++++------- src/Navaids/navlist.cxx | 2 +- src/Navaids/positioned.cxx | 2 +- src/Navaids/procedure.cxx | 12 ++++++------ src/Navaids/route.cxx | 6 +++--- src/Navaids/routePath.cxx | 10 +++++----- src/Navaids/waypoint.cxx | 2 +- src/Traffic/SchedFlight.cxx | 6 +++--- src/Traffic/Schedule.cxx | 18 +++++++++--------- src/Traffic/TrafficMgr.cxx | 24 ++++++++++++------------ 17 files changed, 82 insertions(+), 81 deletions(-) diff --git a/src/Main/fg_props.cxx b/src/Main/fg_props.cxx index d8bda0f08..2d21e2dc2 100644 --- a/src/Main/fg_props.cxx +++ b/src/Main/fg_props.cxx @@ -79,6 +79,7 @@ LogClassMapping log_class_mappings [] = { LogClassMapping(SG_AI, "ai"), LogClassMapping(SG_ENVIRONMENT, "environment"), LogClassMapping(SG_SOUND, "sound"), + LogClassMapping(SG_NAVAID, "navaid"), LogClassMapping(SG_UNDEFD, "") }; diff --git a/src/Navaids/FlightPlan.cxx b/src/Navaids/FlightPlan.cxx index af82fa250..3f3eff4f6 100644 --- a/src/Navaids/FlightPlan.cxx +++ b/src/Navaids/FlightPlan.cxx @@ -189,7 +189,7 @@ void FlightPlan::deleteIndex(int aIndex) } if ((index < 0) || (index >= numLegs())) { - SG_LOG(SG_AUTOPILOT, SG_WARN, "removeAtIndex with invalid index:" << aIndex); + SG_LOG(SG_NAVAID, SG_WARN, "removeAtIndex with invalid index:" << aIndex); return; } @@ -511,7 +511,7 @@ void FlightPlan::setApproach(flightgear::Approach *app) bool FlightPlan::save(const SGPath& path) { - SG_LOG(SG_IO, SG_INFO, "Saving route to " << path.str()); + SG_LOG(SG_NAVAID, SG_INFO, "Saving route to " << path.str()); try { SGPropertyNode_ptr d(new SGPropertyNode); d->setIntValue("version", 2); @@ -553,7 +553,7 @@ bool FlightPlan::save(const SGPath& path) writeProperties(path.str(), d, true /* write-all */); return true; } catch (sg_exception& e) { - SG_LOG(SG_IO, SG_ALERT, "Failed to save flight-plan '" << path.str() << "'. " << e.getMessage()); + SG_LOG(SG_NAVAID, SG_ALERT, "Failed to save flight-plan '" << path.str() << "'. " << e.getMessage()); return false; } } @@ -562,13 +562,13 @@ bool FlightPlan::load(const SGPath& path) { if (!path.exists()) { - SG_LOG(SG_IO, SG_ALERT, "Failed to load flight-plan '" << path.str() + SG_LOG(SG_NAVAID, SG_ALERT, "Failed to load flight-plan '" << path.str() << "'. The file does not exist."); return false; } SGPropertyNode_ptr routeData(new SGPropertyNode); - SG_LOG(SG_IO, SG_INFO, "going to read flight-plan from:" << path.str()); + SG_LOG(SG_NAVAID, SG_INFO, "going to read flight-plan from:" << path.str()); bool Status = false; lockDelegate(); @@ -594,7 +594,7 @@ bool FlightPlan::load(const SGPath& path) } Status = true; } catch (sg_exception& e) { - SG_LOG(SG_IO, SG_ALERT, "Failed to load flight-plan '" << e.getOrigin() + SG_LOG(SG_NAVAID, SG_ALERT, "Failed to load flight-plan '" << e.getOrigin() << "'. " << e.getMessage()); Status = false; } @@ -764,7 +764,7 @@ bool FlightPlan::loadPlainTextRoute(const SGPath& path) _legs.push_back(new Leg(this, w)); } // of line iteration } catch (sg_exception& e) { - SG_LOG(SG_IO, SG_ALERT, "Failed to load route from: '" << path.str() << "'. " << e.getMessage()); + SG_LOG(SG_NAVAID, SG_ALERT, "Failed to load route from: '" << path.str() << "'. " << e.getMessage()); _legs.clear(); return false; } @@ -824,7 +824,7 @@ WayptRef FlightPlan::waypointFromString(const string& tgt ) string_list pieces(simgear::strutils::split(target, "/")); FGPositionedRef p = FGPositioned::findClosestWithIdent(pieces.front(), basePosition); if (!p) { - SG_LOG( SG_AUTOPILOT, SG_INFO, "Unable to find FGPositioned with ident:" << pieces.front()); + SG_LOG( SG_NAVAID, SG_INFO, "Unable to find FGPositioned with ident:" << pieces.front()); return NULL; } @@ -841,12 +841,12 @@ WayptRef FlightPlan::waypointFromString(const string& tgt ) } else if (pieces.size() == 2) { FGAirport* apt = dynamic_cast(p.ptr()); if (!apt) { - SG_LOG(SG_AUTOPILOT, SG_INFO, "Waypoint is not an airport:" << pieces.front()); + SG_LOG(SG_NAVAID, SG_INFO, "Waypoint is not an airport:" << pieces.front()); return NULL; } if (!apt->hasRunwayWithIdent(pieces[1])) { - SG_LOG(SG_AUTOPILOT, SG_INFO, "No runway: " << pieces[1] << " at " << pieces[0]); + SG_LOG(SG_NAVAID, SG_INFO, "No runway: " << pieces[1] << " at " << pieces[0]); return NULL; } @@ -856,7 +856,7 @@ WayptRef FlightPlan::waypointFromString(const string& tgt ) // navid/radial/navid/radial notation FGPositionedRef p2 = FGPositioned::findClosestWithIdent(pieces[2], basePosition); if (!p2) { - SG_LOG( SG_AUTOPILOT, SG_INFO, "Unable to find FGPositioned with ident:" << pieces[2]); + SG_LOG( SG_NAVAID, SG_INFO, "Unable to find FGPositioned with ident:" << pieces[2]); return NULL; } @@ -868,7 +868,7 @@ WayptRef FlightPlan::waypointFromString(const string& tgt ) SGGeod intersection; bool ok = SGGeodesy::radialIntersection(p->geod(), r1, p2->geod(), r2, intersection); if (!ok) { - SG_LOG(SG_AUTOPILOT, SG_INFO, "no valid intersection for:" << target); + SG_LOG(SG_NAVAID, SG_INFO, "no valid intersection for:" << target); return NULL; } @@ -877,7 +877,7 @@ WayptRef FlightPlan::waypointFromString(const string& tgt ) } if (!wpt) { - SG_LOG(SG_AUTOPILOT, SG_INFO, "Unable to parse waypoint:" << target); + SG_LOG(SG_NAVAID, SG_INFO, "Unable to parse waypoint:" << target); return NULL; } diff --git a/src/Navaids/LevelDXML.cxx b/src/Navaids/LevelDXML.cxx index 49ab15d3f..41866cb71 100644 --- a/src/Navaids/LevelDXML.cxx +++ b/src/Navaids/LevelDXML.cxx @@ -250,7 +250,7 @@ Waypt* NavdataVisitor::buildWaypoint(RouteBase* owner) SGGeodesy::direct(pos, _course, _dmeDistance, pos2, az2); wp = new BasicWaypt(pos2, _wayptName, owner); } else { - SG_LOG(SG_GENERAL, SG_ALERT, "implement waypoint type:" << _wayptType); + SG_LOG(SG_NAVAID, SG_ALERT, "implement waypoint type:" << _wayptType); throw sg_format_exception("Unrecognized waypt type", _wayptType); } @@ -327,11 +327,11 @@ void NavdataVisitor::pi (const char * target, const char * data) { } void NavdataVisitor::warning (const char * message, int line, int column) { - SG_LOG(SG_IO, SG_WARN, "Warning: " << message << " (" << line << ',' << column << ')'); + SG_LOG(SG_NAVAID, SG_WARN, "Warning: " << message << " (" << line << ',' << column << ')'); } void NavdataVisitor::error (const char * message, int line, int column) { - SG_LOG(SG_IO, SG_ALERT, "Error: " << message << " (" << line << ',' << column << ')'); + SG_LOG(SG_NAVAID, SG_ALERT, "Error: " << message << " (" << line << ',' << column << ')'); } } diff --git a/src/Navaids/NavDataCache.cxx b/src/Navaids/NavDataCache.cxx index 17937f926..e7d885ef0 100644 --- a/src/Navaids/NavDataCache.cxx +++ b/src/Navaids/NavDataCache.cxx @@ -65,7 +65,7 @@ using std::string; -#define SG_NAVCACHE SG_GENERAL +#define SG_NAVCACHE SG_NAVAID //#define LAZY_OCTREE_UPDATES 1 namespace { @@ -163,7 +163,7 @@ public: SGTimeStamp st; st.stamp(); _cache->doRebuild(); - SG_LOG(SG_GENERAL, SG_INFO, "cache rebuild took:" << st.elapsedMSec() << "msec"); + SG_LOG(SG_NAVCACHE, SG_INFO, "cache rebuild took:" << st.elapsedMSec() << "msec"); SGGuard g(_lock); _isFinished = true; @@ -1338,7 +1338,7 @@ PositionedID NavDataCache::insertAirport(FGPositioned::Type ty, const string& id void NavDataCache::updatePosition(PositionedID item, const SGGeod &pos) { if (d->cache.find(item) != d->cache.end()) { - SG_LOG(SG_GENERAL, SG_DEBUG, "updating position of an item in the cache"); + SG_LOG(SG_NAVCACHE, SG_DEBUG, "updating position of an item in the cache"); d->cache[item]->modifyPosition(pos); } diff --git a/src/Navaids/airways.cxx b/src/Navaids/airways.cxx index e43687b1d..70ff237c7 100644 --- a/src/Navaids/airways.cxx +++ b/src/Navaids/airways.cxx @@ -131,7 +131,7 @@ void Airway::load(const SGPath& path) sg_gzifstream in( path.str() ); if ( !in.is_open() ) { - SG_LOG( SG_GENERAL, SG_ALERT, "Cannot open file: " << path.str() ); + SG_LOG( SG_NAVAID, SG_ALERT, "Cannot open file: " << path.str() ); throw sg_io_exception("Could not open airways data", sg_location(path.str())); } // toss the first two lines of the file @@ -174,13 +174,13 @@ void Airway::Network::addEdge(int aWay, const SGGeod& aStartPos, FGPositionedRef end = FGPositioned::findClosestWithIdent(aEndIdent, aEndPos); if (!start) { - SG_LOG(SG_GENERAL, SG_DEBUG, "unknown airways start pt: '" << aStartIdent << "'"); + SG_LOG(SG_NAVAID, SG_DEBUG, "unknown airways start pt: '" << aStartIdent << "'"); start = FGPositioned::createUserWaypoint(aStartIdent, aStartPos); return; } if (!end) { - SG_LOG(SG_GENERAL, SG_DEBUG, "unknown airways end pt: '" << aEndIdent << "'"); + SG_LOG(SG_NAVAID, SG_DEBUG, "unknown airways end pt: '" << aEndIdent << "'"); end = FGPositioned::createUserWaypoint(aEndIdent, aEndPos); return; } @@ -219,8 +219,8 @@ bool Airway::Network::route(WayptRef aFrom, WayptRef aTo, boost::tie(to, exactTo) = findClosestNode(aTo); #ifdef DEBUG_AWY_SEARCH - SG_LOG(SG_GENERAL, SG_INFO, "from:" << from->ident() << "/" << from->name()); - SG_LOG(SG_GENERAL, SG_INFO, "to:" << to->ident() << "/" << to->name()); + SG_LOG(SG_NAVAID, SG_INFO, "from:" << from->ident() << "/" << from->name()); + SG_LOG(SG_NAVAID, SG_INFO, "to:" << to->ident() << "/" << to->name()); #endif bool ok = search2(from, to, aPath); @@ -348,7 +348,7 @@ bool Airway::Network::search2(FGPositionedRef aStart, FGPositionedRef aDest, closedNodes.insert(xp->guid()); #ifdef DEBUG_AWY_SEARCH - SG_LOG(SG_GENERAL, SG_INFO, "x:" << xp->ident() << ", f(x)=" << x->totalCost()); + SG_LOG(SG_NAVAID, SG_INFO, "x:" << xp->ident() << ", f(x)=" << x->totalCost()); #endif // check if xp is the goal; if so we're done, since there cannot be an open @@ -373,7 +373,7 @@ bool Airway::Network::search2(FGPositionedRef aStart, FGPositionedRef aDest, if (g > y->distanceFromStart) { // worse path, ignore #ifdef DEBUG_AWY_SEARCH - SG_LOG(SG_GENERAL, SG_INFO, "\tabandoning " << yp->ident() << + SG_LOG(SG_NAVAID, SG_INFO, "\tabandoning " << yp->ident() << " path is worse: g(y)" << y->distanceFromStart << ", g'=" << g); #endif continue; @@ -382,7 +382,7 @@ bool Airway::Network::search2(FGPositionedRef aStart, FGPositionedRef aDest, // we need to update y. Unfortunately this means rebuilding the heap, // since y's score can change arbitrarily #ifdef DEBUG_AWY_SEARCH - SG_LOG(SG_GENERAL, SG_INFO, "\tfixing up previous for new path to " << yp->ident() << ", d =" << g); + SG_LOG(SG_NAVAID, SG_INFO, "\tfixing up previous for new path to " << yp->ident() << ", d =" << g); #endif y->previous = x; y->distanceFromStart = g; @@ -391,7 +391,7 @@ bool Airway::Network::search2(FGPositionedRef aStart, FGPositionedRef aDest, } else { // not open, insert a new node for y into the heap y = new AStarOpenNode(yp, edgeDistanceM, other.first, aDest, x); #ifdef DEBUG_AWY_SEARCH - SG_LOG(SG_GENERAL, SG_INFO, "\ty=" << yp->ident() << ", f(y)=" << y->totalCost()); + SG_LOG(SG_NAVAID, SG_INFO, "\ty=" << yp->ident() << ", f(y)=" << y->totalCost()); #endif openNodes.push_back(y); std::push_heap(openNodes.begin(), openNodes.end(), ordering); @@ -399,7 +399,7 @@ bool Airway::Network::search2(FGPositionedRef aStart, FGPositionedRef aDest, } // of neighbour iteration } // of open node iteration - SG_LOG(SG_GENERAL, SG_INFO, "A* failed to find route"); + SG_LOG(SG_NAVAID, SG_INFO, "A* failed to find route"); return false; } diff --git a/src/Navaids/awynet.cxx b/src/Navaids/awynet.cxx index 3ed794c17..7642673b5 100644 --- a/src/Navaids/awynet.cxx +++ b/src/Navaids/awynet.cxx @@ -207,7 +207,7 @@ void FGAirwayNetwork::load(const SGPath& path) sg_gzifstream in( path.str() ); if ( !in.is_open() ) { - SG_LOG( SG_GENERAL, SG_ALERT, "Cannot open file: " << path.str() ); + SG_LOG( SG_NAVAID, SG_ALERT, "Cannot open file: " << path.str() ); exit(-1); } // toss the first two lines of the file @@ -364,7 +364,7 @@ FGAirRoute FGAirwayNetwork::findShortestRoute(int start, int end) if (!foundRoute) { - SG_LOG( SG_GENERAL, SG_INFO, "Failed to find route from waypoint " << start << " to " << end ); + SG_LOG( SG_NAVAID, SG_INFO, "Failed to find route from waypoint " << start << " to " << end ); cerr << "Failed to find route from waypoint " << start << " to " << end << endl; //exit(1); } @@ -458,7 +458,7 @@ void FGAirwayNetwork::trace(FGNode *currNode, int end, int depth, double distanc } else { - //SG_LOG( SG_GENERAL, SG_DEBUG, "4" ); + //SG_LOG( SG_NAVAID, SG_DEBUG, "4" ); //cerr << "4" << endl; } traceStack.pop_back(); diff --git a/src/Navaids/fixlist.cxx b/src/Navaids/fixlist.cxx index eb71baa0d..2dc8806ea 100644 --- a/src/Navaids/fixlist.cxx +++ b/src/Navaids/fixlist.cxx @@ -49,7 +49,7 @@ void loadFixes(const SGPath& path) { sg_gzifstream in( path.str() ); if ( !in.is_open() ) { - SG_LOG( SG_GENERAL, SG_ALERT, "Cannot open file: " << path.str() ); + SG_LOG( SG_NAVAID, SG_ALERT, "Cannot open file: " << path.str() ); exit(-1); } diff --git a/src/Navaids/navdb.cxx b/src/Navaids/navdb.cxx index 5c592c1c4..b94f1a3f8 100644 --- a/src/Navaids/navdb.cxx +++ b/src/Navaids/navdb.cxx @@ -97,7 +97,7 @@ void alignLocaliserWithRunway(FGRunway* rwy, const string& ident, SGGeod& pos, d pos = SGGeod::fromGeodFt(newPos, pos.getElevationFt()); heading = rwy->headingDeg(); } else { - SG_LOG(SG_GENERAL, SG_DEBUG, "localizer:" << ident << ", aligning with runway " + SG_LOG(SG_NAVAID, SG_DEBUG, "localizer:" << ident << ", aligning with runway " << rwy->ident() << " exceeded heading threshold"); } } @@ -107,7 +107,7 @@ static double defaultNavRange(const string& ident, FGPositioned::Type type) // Ranges are included with the latest data format, no need to // assign our own defaults, unless the range is not set for some // reason. - SG_LOG(SG_GENERAL, SG_DEBUG, "navaid " << ident << " has no range set, using defaults"); + SG_LOG(SG_NAVAID, SG_DEBUG, "navaid " << ident << " has no range set, using defaults"); switch (type) { case FGPositioned::NDB: case FGPositioned::VOR: @@ -216,7 +216,7 @@ bool navDBInit(const SGPath& path) { sg_gzifstream in( path.str() ); if ( !in.is_open() ) { - SG_LOG( SG_GENERAL, SG_ALERT, "Cannot open file: " << path.str() ); + SG_LOG( SG_NAVAID, SG_ALERT, "Cannot open file: " << path.str() ); return false; } @@ -238,11 +238,11 @@ bool navDBInit(const SGPath& path) bool loadCarrierNav(const SGPath& path) { - SG_LOG( SG_GENERAL, SG_INFO, "opening file: " << path.str() ); + SG_LOG( SG_NAVAID, SG_INFO, "opening file: " << path.str() ); sg_gzifstream incarrier( path.str() ); if ( !incarrier.is_open() ) { - SG_LOG( SG_GENERAL, SG_ALERT, "Cannot open file: " << path.str() ); + SG_LOG( SG_NAVAID, SG_ALERT, "Cannot open file: " << path.str() ); return false; } @@ -256,11 +256,11 @@ bool loadCarrierNav(const SGPath& path) bool loadTacan(const SGPath& path, FGTACANList *channellist) { - SG_LOG( SG_GENERAL, SG_INFO, "opening file: " << path.str() ); + SG_LOG( SG_NAVAID, SG_INFO, "opening file: " << path.str() ); sg_gzifstream inchannel( path.str() ); if ( !inchannel.is_open() ) { - SG_LOG( SG_GENERAL, SG_ALERT, "Cannot open file: " << path.str() ); + SG_LOG( SG_NAVAID, SG_ALERT, "Cannot open file: " << path.str() ); return false; } diff --git a/src/Navaids/navlist.cxx b/src/Navaids/navlist.cxx index d63b958f6..eb6bac754 100644 --- a/src/Navaids/navlist.cxx +++ b/src/Navaids/navlist.cxx @@ -302,7 +302,7 @@ bool FGTACANList::add( FGTACANRecord *c ) FGTACANRecord *FGTACANList::findByChannel( const string& channel ) { const tacan_list_type& stations = ident_channels[channel]; - SG_LOG( SG_INSTR, SG_DEBUG, "findByChannel " << channel<< " size " << stations.size() ); + SG_LOG( SG_NAVAID, SG_DEBUG, "findByChannel " << channel<< " size " << stations.size() ); if (!stations.empty()) { return stations[0]; diff --git a/src/Navaids/positioned.cxx b/src/Navaids/positioned.cxx index 18bb22f62..bced11728 100644 --- a/src/Navaids/positioned.cxx +++ b/src/Navaids/positioned.cxx @@ -131,7 +131,7 @@ FGPositioned::Type FGPositioned::typeFromName(const std::string& aName) } } - SG_LOG(SG_GENERAL, SG_WARN, "FGPositioned::typeFromName: couldn't match:" << aName); + SG_LOG(SG_NAVAID, SG_WARN, "FGPositioned::typeFromName: couldn't match:" << aName); return INVALID; } diff --git a/src/Navaids/procedure.cxx b/src/Navaids/procedure.cxx index 94afcdd2c..f94ec0cc1 100644 --- a/src/Navaids/procedure.cxx +++ b/src/Navaids/procedure.cxx @@ -114,7 +114,7 @@ bool Approach::route(WayptRef aIAF, WayptVec& aWps) } // of transitions iteration if (!haveTrans) { - SG_LOG(SG_GENERAL, SG_INFO, "approach " << ident() << " has no transition " << + SG_LOG(SG_NAVAID, SG_INFO, "approach " << ident() << " has no transition " << "for IAF: " << aIAF->ident()); return false; } @@ -250,7 +250,7 @@ bool ArrivalDeparture::commonRoute(Transition* t, WayptVec& aPath, FGRunwayRef a return true; } - SG_LOG(SG_GENERAL, SG_INFO, ident() << " using runway transition for " << r->first->ident()); + SG_LOG(SG_NAVAID, SG_INFO, ident() << " using runway transition for " << r->first->ident()); r->second->route(aPath); return true; } @@ -264,7 +264,7 @@ Transition* ArrivalDeparture::findTransitionByEnroute(Waypt* aEnroute) const WptTransitionMap::const_iterator eit; for (eit = _enrouteTransitions.begin(); eit != _enrouteTransitions.end(); ++eit) { if (eit->second->enroute()->matches(aEnroute)) { - SG_LOG(SG_GENERAL, SG_INFO, ident() << " using enroute transition " << eit->second->ident()); + SG_LOG(SG_NAVAID, SG_INFO, ident() << " using enroute transition " << eit->second->ident()); return eit->second; } } // of enroute transition iteration @@ -276,7 +276,7 @@ WayptRef ArrivalDeparture::findBestTransition(const SGGeod& aPos) const { // no transitions, that's easy if (_enrouteTransitions.empty()) { - SG_LOG(SG_GENERAL, SG_INFO, "no enroute transitions for " << ident()); + SG_LOG(SG_NAVAID, SG_INFO, "no enroute transitions for " << ident()); return _common.front(); } @@ -285,7 +285,7 @@ WayptRef ArrivalDeparture::findBestTransition(const SGGeod& aPos) const WptTransitionMap::const_iterator eit; for (eit = _enrouteTransitions.begin(); eit != _enrouteTransitions.end(); ++eit) { WayptRef c = eit->second->enroute(); - SG_LOG(SG_GENERAL, SG_INFO, "findBestTransition for " << ident() << ", looking at " << c->ident()); + SG_LOG(SG_NAVAID, SG_INFO, "findBestTransition for " << ident() << ", looking at " << c->ident()); // assert(c->hasFixedPosition()); double cd = SGGeodesy::distanceM(aPos, c->position()); @@ -321,7 +321,7 @@ SID::SID(const string& aIdent, FGAirport* apt) : bool SID::route(FGRunwayRef aWay, Transition* trans, WayptVec& aPath) { if (!isForRunway(aWay)) { - SG_LOG(SG_GENERAL, SG_WARN, "SID " << ident() << " not for runway " << aWay->ident()); + SG_LOG(SG_NAVAID, SG_WARN, "SID " << ident() << " not for runway " << aWay->ident()); return false; } diff --git a/src/Navaids/route.cxx b/src/Navaids/route.cxx index b52a3f574..952860c4d 100644 --- a/src/Navaids/route.cxx +++ b/src/Navaids/route.cxx @@ -330,7 +330,7 @@ void RouteBase::dumpRouteToKML(const WayptVec& aRoute, const std::string& aName) std::fstream f; f.open(p.str().c_str(), fstream::out | fstream::app); if (!f.is_open()) { - SG_LOG(SG_GENERAL, SG_WARN, "unable to open:" << p.str()); + SG_LOG(SG_NAVAID, SG_WARN, "unable to open:" << p.str()); return; } @@ -376,10 +376,10 @@ void RouteBase::loadAirportProcedures(const SGPath& aPath, FGAirport* aApt) NavdataVisitor visitor(aApt, aPath); readXML(aPath.str(), visitor); } catch (sg_io_exception& ex) { - SG_LOG(SG_GENERAL, SG_WARN, "failure parsing procedures: " << aPath.str() << + SG_LOG(SG_NAVAID, SG_WARN, "failure parsing procedures: " << aPath.str() << "\n\t" << ex.getMessage() << "\n\tat:" << ex.getLocation().asString()); } catch (sg_exception& ex) { - SG_LOG(SG_GENERAL, SG_WARN, "failure parsing procedures: " << aPath.str() << + SG_LOG(SG_NAVAID, SG_WARN, "failure parsing procedures: " << aPath.str() << "\n\t" << ex.getMessage()); } } diff --git a/src/Navaids/routePath.cxx b/src/Navaids/routePath.cxx index 160407528..6353fb5b6 100644 --- a/src/Navaids/routePath.cxx +++ b/src/Navaids/routePath.cxx @@ -39,7 +39,7 @@ double pointsKnownDistanceFromGC(const SGGeoc& a, const SGGeoc&b, const SGGeoc& double p = atan2(sin(bDist)*cos(A), cos(bDist)); if (sqr(cos(dist)) > sqr(r)) { - SG_LOG(SG_GENERAL, SG_INFO, "pointsKnownDistanceFromGC, no points exist"); + SG_LOG(SG_NAVAID, SG_INFO, "pointsKnownDistanceFromGC, no points exist"); return -1.0; } @@ -256,7 +256,7 @@ bool RoutePath::computedPositionForIndex(int index, SGGeod& r) const return true; } - SG_LOG(SG_GENERAL, SG_INFO, "RoutePath::computedPositionForIndex: unhandled type:" << w->type()); + SG_LOG(SG_NAVAID, SG_INFO, "RoutePath::computedPositionForIndex: unhandled type:" << w->type()); return false; } @@ -287,7 +287,7 @@ double RoutePath::computeAltitudeForIndex(int index) const if (!computedPositionForIndex(index, pos) || !computedPositionForIndex(index - 1, prevPos)) { - SG_LOG(SG_GENERAL, SG_WARN, "unable to compute position for waypoints"); + SG_LOG(SG_NAVAID, SG_WARN, "unable to compute position for waypoints"); throw sg_range_exception("unable to compute position for waypoints"); } @@ -325,7 +325,7 @@ double RoutePath::computeTrackForIndex(int index) const Hold* h = (Hold*) w.get(); return h->inboundRadial(); } else if (w->type() == "vectors") { - SG_LOG(SG_GENERAL, SG_WARN, "asked for track from VECTORS"); + SG_LOG(SG_NAVAID, SG_WARN, "asked for track from VECTORS"); throw sg_range_exception("asked for track from vectors waypt"); } else if (w->type() == "runway") { FGRunway* rwy = static_cast(w.get())->runway(); @@ -338,7 +338,7 @@ double RoutePath::computeTrackForIndex(int index) const if (!computedPositionForIndex(index, pos) || !computedPositionForIndex(index - 1, prevPos)) { - SG_LOG(SG_GENERAL, SG_WARN, "unable to compute position for waypoints"); + SG_LOG(SG_NAVAID, SG_WARN, "unable to compute position for waypoints"); throw sg_range_exception("unable to compute position for waypoints"); } diff --git a/src/Navaids/waypoint.cxx b/src/Navaids/waypoint.cxx index ede0f026d..81e2c5c82 100644 --- a/src/Navaids/waypoint.cxx +++ b/src/Navaids/waypoint.cxx @@ -78,7 +78,7 @@ NavaidWaypoint::NavaidWaypoint(FGPositioned* aPos, RouteBase* aOwner) : _navaid(aPos) { if (aPos->type() == FGPositioned::RUNWAY) { - SG_LOG(SG_GENERAL, SG_WARN, "sure you don't want to be building a runway waypt here?"); + SG_LOG(SG_NAVAID, SG_WARN, "sure you don't want to be building a runway waypt here?"); } } diff --git a/src/Traffic/SchedFlight.cxx b/src/Traffic/SchedFlight.cxx index e04f1d8a4..6ca4ed0a6 100644 --- a/src/Traffic/SchedFlight.cxx +++ b/src/Traffic/SchedFlight.cxx @@ -132,7 +132,7 @@ FGScheduledFlight::FGScheduledFlight(const string& cs, else { repeatPeriod = 365*24*60*60; - SG_LOG( SG_GENERAL, SG_ALERT, "Unknown repeat period in flight plan " + SG_LOG( SG_AI, SG_ALERT, "Unknown repeat period in flight plan " "of flight '" << cs << "': " << rep ); } @@ -272,13 +272,13 @@ bool FGScheduledFlight::initializeAirports() departurePort = FGAirport::findByIdent(depId); if(departurePort == NULL) { - SG_LOG( SG_GENERAL, SG_DEBUG, "Traffic manager could not find departure airport : " << depId); + SG_LOG( SG_AI, SG_DEBUG, "Traffic manager could not find departure airport : " << depId); return false; } arrivalPort = FGAirport::findByIdent(arrId); if(arrivalPort == NULL) { - SG_LOG( SG_GENERAL, SG_DEBUG, "Traffic manager could not find arrival airport : " << arrId); + SG_LOG( SG_AI, SG_DEBUG, "Traffic manager could not find arrival airport : " << arrId); return false; } diff --git a/src/Traffic/Schedule.cxx b/src/Traffic/Schedule.cxx index 49f933119..dd38787ac 100644 --- a/src/Traffic/Schedule.cxx +++ b/src/Traffic/Schedule.cxx @@ -240,7 +240,7 @@ bool FGAISchedule::update(time_t now, const SGVec3d& userCart) // This flight entry is entirely in the past, do we need to // push it forward in time to the next scheduled departure. if (flight->getArrivalTime() < now) { - SG_LOG (SG_GENERAL, SG_BULK, "Traffic Manager: Flight is in the Past"); + SG_LOG (SG_AI, SG_BULK, "Traffic Manager: Flight is in the Past"); // Don't just update: check whether we need to load a new leg. etc. // This update occurs for distant aircraft, so we can update the current leg // and detach it from the current list of aircraft. @@ -272,14 +272,14 @@ bool FGAISchedule::update(time_t now, const SGVec3d& userCart) SGGeodesy::direct(dep->geod(), course, coveredDistance, position, az2); - SG_LOG (SG_GENERAL, SG_BULK, "Traffic Manager: Flight is in progress, %=" << x); + SG_LOG (SG_AI, SG_BULK, "Traffic Manager: Flight is in progress, %=" << x); speed = ((distanceM - coveredDistance) * SG_METER_TO_NM) / 3600.0; } else { // not departed yet //remainingTimeEnroute = totalTimeEnroute; elapsedTimeEnroute = 0; position = dep->geod(); - SG_LOG (SG_GENERAL, SG_BULK, "Traffic Manager: Flight is pending, departure in " + SG_LOG (SG_AI, SG_BULK, "Traffic Manager: Flight is pending, departure in " << flight->getDepartureTime() - now << " seconds "); } } else { @@ -297,7 +297,7 @@ bool FGAISchedule::update(time_t now, const SGVec3d& userCart) // then 500nm, create this flight. At jet speeds 500 nm is roughly // one hour flight time, so that would be a good approximate point // to start a more detailed simulation of this aircraft. - SG_LOG (SG_GENERAL, SG_BULK, "Traffic manager: " << registration << " is scheduled for a flight from " + SG_LOG (SG_AI, SG_BULK, "Traffic manager: " << registration << " is scheduled for a flight from " << dep->getId() << " to " << arr->getId() << ". Current distance to user: " << distanceToUser); if (distanceToUser >= TRAFFICTOAIDISTTOSTART) { @@ -323,7 +323,7 @@ bool FGAISchedule::createAIAircraft(FGScheduledFlight* flight, double speedKnots FGAirport* dep = flight->getDepartureAirport(); FGAirport* arr = flight->getArrivalAirport(); string flightPlanName = dep->getId() + "-" + arr->getId() + ".xml"; - SG_LOG(SG_GENERAL, SG_INFO, "Traffic manager: Creating AIModel from:" << flightPlanName); + SG_LOG(SG_AI, SG_INFO, "Traffic manager: Creating AIModel from:" << flightPlanName); // Only allow traffic to be created when the model path (or the AI version of mp) exists SGPath mp(globals->get_fg_root()); @@ -334,7 +334,7 @@ bool FGAISchedule::createAIAircraft(FGScheduledFlight* flight, double speedKnots mp_ai.append(modelPath); if (!mp.exists() && !mp_ai.exists()) { - SG_LOG(SG_GENERAL, SG_WARN, "TrafficManager: Could not load model " << mp_ai.str()); + SG_LOG(SG_AI, SG_WARN, "TrafficManager: Could not load model " << mp_ai.str()); return true; } @@ -388,7 +388,7 @@ void FGAISchedule::scheduleFlights(time_t now) } //string startingPort; string userPort = fgGetString("/sim/presets/airport-id"); - SG_LOG(SG_GENERAL, SG_BULK, "Scheduling Flights for : " << modelPath << " " << registration << " " << homePort); + SG_LOG(SG_AI, SG_BULK, "Scheduling Flights for : " << modelPath << " " << registration << " " << homePort); FGScheduledFlight *flight = NULL; do { if (currentDestination.empty()) { @@ -423,7 +423,7 @@ void FGAISchedule::scheduleFlights(time_t now) depT = depT.substr(0,24); arrT = arrT.substr(0,24); - SG_LOG(SG_GENERAL, SG_BULK, " Flight " << flight->getCallSign() << ":" + SG_LOG(SG_AI, SG_BULK, " Flight " << flight->getCallSign() << ":" << " " << flight->getDepartureAirport()->getId() << ":" << " " << depT << ":" << " \"" << flight->getArrivalAirport()->getId() << "\"" << ":" @@ -431,7 +431,7 @@ void FGAISchedule::scheduleFlights(time_t now) flights.push_back(flight); } while (currentDestination != homePort); - SG_LOG(SG_GENERAL, SG_BULK, " Done "); + SG_LOG(SG_AI, SG_BULK, " Done "); } bool FGAISchedule::next() diff --git a/src/Traffic/TrafficMgr.cxx b/src/Traffic/TrafficMgr.cxx index ee8e9c64f..2c81a1d30 100644 --- a/src/Traffic/TrafficMgr.cxx +++ b/src/Traffic/TrafficMgr.cxx @@ -307,7 +307,7 @@ void FGTrafficManager::loadHeuristics() std::ifstream data(cacheData.c_str()); data >> revisionStr; if (revisionStr != "[TrafficManagerCachedata:ref:2011:09:04]") { - SG_LOG(SG_GENERAL, SG_ALERT,"Traffic Manager Warning: discarding outdated cachefile " << + SG_LOG(SG_AI, SG_ALERT,"Traffic Manager Warning: discarding outdated cachefile " << cacheData.c_str() << " for Airport " << airport); } else { while (1) { @@ -317,7 +317,7 @@ void FGTrafficManager::loadHeuristics() break; HeuristicMapIterator itr = heurMap.find(h.registration); if (itr != heurMap.end()) { - SG_LOG(SG_GENERAL, SG_WARN,"Traffic Manager Warning: found duplicate tailnumber " << + SG_LOG(SG_AI, SG_WARN,"Traffic Manager Warning: found duplicate tailnumber " << h.registration << " for AI aircraft"); } else { heurMap[h.registration] = h; @@ -450,7 +450,7 @@ void FGTrafficManager::readTimeTableFromFile(SGPath infileName) if (!tokens.empty()) { if (tokens[0] == string("AC")) { if (tokens.size() != 13) { - SG_LOG(SG_GENERAL, SG_ALERT, "Error parsing traffic file " << infileName.str() << " at " << buffString); + SG_LOG(SG_AI, SG_ALERT, "Error parsing traffic file " << infileName.str() << " at " << buffString); exit(1); } model = tokens[12]; @@ -471,11 +471,11 @@ void FGTrafficManager::readTimeTableFromFile(SGPath infileName) offset = atof(tokens[7].c_str());; if (!FGAISchedule::validModelPath(model)) { - SG_LOG(SG_GENERAL, SG_WARN, "TrafficMgr: Missing model path:" << + SG_LOG(SG_AI, SG_WARN, "TrafficMgr: Missing model path:" << model << " from " << infileName.str()); } else { - SG_LOG(SG_GENERAL, SG_INFO, "Adding Aircraft" << model << " " << livery << " " << homePort << " " + SG_LOG(SG_AI, SG_INFO, "Adding Aircraft" << model << " " << livery << " " << homePort << " " << registration << " " << flightReq << " " << isHeavy << " " << acType << " " << airline << " " << m_class << " " << FlightType << " " << radius << " " << offset); @@ -496,7 +496,7 @@ void FGTrafficManager::readTimeTableFromFile(SGPath infileName) if (tokens[0] == string("FLIGHT")) { //cerr << "Found flight " << buffString << " size is : " << tokens.size() << endl; if (tokens.size() != 10) { - SG_LOG(SG_GENERAL, SG_ALERT, "Error parsing traffic file " << infileName.str() << " at " << buffString); + SG_LOG(SG_AI, SG_ALERT, "Error parsing traffic file " << infileName.str() << " at " << buffString); exit(1); } string callsign = tokens[1]; @@ -511,7 +511,7 @@ void FGTrafficManager::readTimeTableFromFile(SGPath infileName) string requiredAircraft = tokens[9]; if (weekdays.size() != 7) { - SG_LOG(SG_GENERAL, SG_ALERT, "Found misconfigured weekdays string" << weekdays); + SG_LOG(SG_AI, SG_ALERT, "Found misconfigured weekdays string" << weekdays); exit(1); } depTime.clear(); @@ -543,7 +543,7 @@ void FGTrafficManager::readTimeTableFromFile(SGPath infileName) snprintf(buffer, 4, "%d/", 0); arrivalTime = string(buffer) + arrTimeGen + string(":00"); } - SG_LOG(SG_GENERAL, SG_ALERT, "Adding flight " << callsign << " " + SG_LOG(SG_AI, SG_ALERT, "Adding flight " << callsign << " " << fltrules << " " << departurePort << " " << arrivalPort << " " @@ -699,7 +699,7 @@ void FGTrafficManager::endElement(const char *name) snprintf(buffer, 16, "%d", acCounter); requiredAircraft = buffer; } - SG_LOG(SG_GENERAL, SG_DEBUG, "Adding flight: " << callsign << " " + SG_LOG(SG_AI, SG_DEBUG, "Adding flight: " << callsign << " " << fltrules << " " << departurePort << " " << arrivalPort << " " @@ -709,7 +709,7 @@ void FGTrafficManager::endElement(const char *name) // For database maintainance purposes, it may be convenient to // if (fgGetBool("/sim/traffic-manager/dumpdata") == true) { - SG_LOG(SG_GENERAL, SG_ALERT, "Traffic Dump FLIGHT," << callsign << "," + SG_LOG(SG_AI, SG_ALERT, "Traffic Dump FLIGHT," << callsign << "," << fltrules << "," << departurePort << "," << arrivalPort << "," @@ -746,7 +746,7 @@ void FGTrafficManager::endAircraft() if (!FGAISchedule::validModelPath(mdl)) { missingModels.insert(mdl); - SG_LOG(SG_GENERAL, SG_WARN, "TrafficMgr: Missing model path:" << mdl); + SG_LOG(SG_AI, SG_WARN, "TrafficMgr: Missing model path:" << mdl); requiredAircraft = homePort = ""; return; } @@ -760,7 +760,7 @@ void FGTrafficManager::endAircraft() } if (fgGetBool("/sim/traffic-manager/dumpdata") == true) { - SG_LOG(SG_GENERAL, SG_ALERT, "Traffic Dump AC," << homePort << "," << registration << "," << requiredAircraft + SG_LOG(SG_AI, SG_ALERT, "Traffic Dump AC," << homePort << "," << registration << "," << requiredAircraft << "," << acType << "," << livery << "," << airline << "," << m_class << "," << offset << "," << radius << "," << flighttype << "," << isHeavy << "," << mdl); } -- 2.39.5