1
0
Fork 0

Use some more logging class variety.

Stop using SG_GENERAL and SG_ALL everywhere. Using different
classes makes switching the classes really useful...
This commit is contained in:
ThorstenB 2011-08-12 00:09:26 +02:00
parent ce97a1e4c5
commit e9a9f8c96d
17 changed files with 72 additions and 67 deletions

View file

@ -108,7 +108,7 @@ pair<double,double> PT_vs_hpt(
} }
// Should never get here. // Should never get here.
SG_LOG(SG_GENERAL, SG_ALERT, "PT_vs_hpt: ran out of layers for h=" << hh ); SG_LOG(SG_ENVIRONMENT, SG_ALERT, "PT_vs_hpt: ran out of layers for h=" << hh );
return make_pair(d0, d0); return make_pair(d0, d0);
} }
@ -250,7 +250,7 @@ double FGAtmo::QNH(const double field_elev, const double field_press) {
double rslt = field_press double rslt = field_press
* pow(1. + ISA::lam0 * field_elev / ISA::T0 * prat, 1./nn); * pow(1. + ISA::lam0 * field_elev / ISA::T0 * prat, 1./nn);
#if 0 #if 0
SG_LOG(SG_GENERAL, SG_ALERT, "QNH: elev: " << field_elev SG_LOG(SG_ENVIRONMENT, SG_ALERT, "QNH: elev: " << field_elev
<< " press: " << field_press << " press: " << field_press
<< " prat: " << prat << " prat: " << prat
<< " rslt: " << rslt << " rslt: " << rslt

View file

@ -678,13 +678,13 @@ FGEnvironment::_recalc_sl_temperature ()
#if 0 #if 0
{ {
SG_LOG(SG_GENERAL, SG_DEBUG, "recalc_sl_temperature: using " SG_LOG(SG_ENVIRONMENT, SG_DEBUG, "recalc_sl_temperature: using "
<< temperature_degc << " @ " << elevation_ft << " :: " << this); << temperature_degc << " @ " << elevation_ft << " :: " << this);
} }
#endif #endif
if (elevation_ft * atmodel::foot >= ISA_def[1].height) { if (elevation_ft * atmodel::foot >= ISA_def[1].height) {
SG_LOG(SG_GENERAL, SG_ALERT, "recalc_sl_temperature: " SG_LOG(SG_ENVIRONMENT, SG_ALERT, "recalc_sl_temperature: "
<< "valid only in troposphere, not " << elevation_ft); << "valid only in troposphere, not " << elevation_ft);
return; return;
} }
@ -728,7 +728,7 @@ FGEnvironment::_recalc_sl_pressure ()
using namespace atmodel; using namespace atmodel;
#if 0 #if 0
{ {
SG_LOG(SG_GENERAL, SG_ALERT, "recalc_sl_pressure: using " SG_LOG(SG_ENVIRONMENT, SG_ALERT, "recalc_sl_pressure: using "
<< pressure_inhg << " and " << pressure_inhg << " and "
<< temperature_degc << " @ " << elevation_ft << " :: " << this); << temperature_degc << " @ " << elevation_ft << " :: " << this);
} }
@ -749,7 +749,7 @@ FGEnvironment::_recalc_alt_pt ()
{ {
static int count(0); static int count(0);
if (++count % 1000 == 0) { if (++count % 1000 == 0) {
SG_LOG(SG_GENERAL, SG_ALERT, SG_LOG(SG_ENVIRONMENT, SG_ALERT,
"recalc_alt_pt for: " << elevation_ft "recalc_alt_pt for: " << elevation_ft
<< " using " << pressure_sea_level_inhg << " using " << pressure_sea_level_inhg
<< " and " << temperature_sea_level_degc << " and " << temperature_sea_level_degc

View file

@ -182,7 +182,7 @@ void LayerTable::read(FGEnvironment * parent )
// cleanup entries with (almost)same altitude // cleanup entries with (almost)same altitude
for( size_type n = 1; n < size(); n++ ) { for( size_type n = 1; n < size(); n++ ) {
if( fabs(at(n)->altitude_ft - at(n-1)->altitude_ft ) < 1 ) { if( fabs(at(n)->altitude_ft - at(n-1)->altitude_ft ) < 1 ) {
SG_LOG( SG_GENERAL, SG_ALERT, "Removing duplicate altitude entry in environment config for altitude " << at(n)->altitude_ft ); SG_LOG( SG_ENVIRONMENT, SG_ALERT, "Removing duplicate altitude entry in environment config for altitude " << at(n)->altitude_ft );
erase( begin() + n ); erase( begin() + n );
} }
} }

View file

@ -134,7 +134,7 @@ FGEnvironmentMgr::~FGEnvironmentMgr ()
void void
FGEnvironmentMgr::init () FGEnvironmentMgr::init ()
{ {
SG_LOG( SG_GENERAL, SG_INFO, "Initializing environment subsystem"); SG_LOG( SG_ENVIRONMENT, SG_INFO, "Initializing environment subsystem");
SGSubsystemGroup::init(); SGSubsystemGroup::init();
fgClouds->Init(); fgClouds->Init();
@ -150,7 +150,7 @@ FGEnvironmentMgr::init ()
void void
FGEnvironmentMgr::reinit () FGEnvironmentMgr::reinit ()
{ {
SG_LOG( SG_GENERAL, SG_INFO, "Reinitializing environment subsystem"); SG_LOG( SG_ENVIRONMENT, SG_INFO, "Reinitializing environment subsystem");
SGSubsystemGroup::reinit(); SGSubsystemGroup::reinit();
} }
@ -265,7 +265,7 @@ FGEnvironmentMgr::update (double dt)
// update closest airport information // update closest airport information
_positionTimeToLive = 30.0; _positionTimeToLive = 30.0;
SG_LOG(SG_ALL, SG_INFO, "FGEnvironmentMgr::update: updating closest airport"); SG_LOG(SG_ENVIRONMENT, SG_INFO, "FGEnvironmentMgr::update: updating closest airport");
SGGeod pos = SGGeod::fromDeg(_longitude_n->getDoubleValue(), SGGeod pos = SGGeod::fromDeg(_longitude_n->getDoubleValue(),
_latitude_n->getDoubleValue()); _latitude_n->getDoubleValue());
@ -273,7 +273,7 @@ FGEnvironmentMgr::update (double dt)
FGAirport * nearestAirport = FGAirport::findClosest(pos, 100.0); FGAirport * nearestAirport = FGAirport::findClosest(pos, 100.0);
if( nearestAirport == NULL ) if( nearestAirport == NULL )
{ {
SG_LOG(SG_ALL,SG_WARN,"FGEnvironmentMgr::update: No airport within 100NM range"); SG_LOG(SG_ENVIRONMENT,SG_WARN,"FGEnvironmentMgr::update: No airport within 100NM range");
} }
else else
{ {
@ -428,7 +428,7 @@ void
FGEnvironmentMgr::set_cloud_layer_coverage_type (int index, int type ) FGEnvironmentMgr::set_cloud_layer_coverage_type (int index, int type )
{ {
if( type < 0 || type >= SGCloudLayer::SG_MAX_CLOUD_COVERAGES ) { if( type < 0 || type >= SGCloudLayer::SG_MAX_CLOUD_COVERAGES ) {
SG_LOG(SG_ALL,SG_WARN,"Unknown cloud layer type " << type << " ignored" ); SG_LOG(SG_ENVIRONMENT,SG_WARN,"Unknown cloud layer type " << type << " ignored" );
return; return;
} }

View file

@ -148,11 +148,11 @@ FGMetar::FGMetar(const string& icao, const string& proxy, const string& port, co
_time = sgTimeGetGMT(_year - 1900, _month - 1, _day, _hour, _minute, 0); _time = sgTimeGetGMT(_year - 1900, _month - 1, _day, _hour, _minute, 0);
SG_LOG(SG_GENERAL, SG_INFO, _data); SG_LOG(SG_ENVIRONMENT, SG_INFO, _data);
if (_x_proxy) if (_x_proxy)
SG_LOG(SG_GENERAL, SG_INFO, "METAR from proxy"); SG_LOG(SG_ENVIRONMENT, SG_INFO, "METAR from proxy");
else else
SG_LOG(SG_GENERAL, SG_INFO, "METAR from weather.noaa.gov"); SG_LOG(SG_ENVIRONMENT, SG_INFO, "METAR from weather.noaa.gov");
} }

View file

@ -83,7 +83,7 @@ inline void MagneticVariation::recalc( double lon, double lat, double alt )
// calculation of magnetic variation is expensive. Cache the position // calculation of magnetic variation is expensive. Cache the position
// and perform this calculation only if it has changed // and perform this calculation only if it has changed
if( _lon != lon || _lat != lat || _alt != alt ) { if( _lon != lon || _lat != lat || _alt != alt ) {
SG_LOG(SG_ALL, SG_DEBUG, "Recalculating magvar for lon=" << lon << ", lat=" << lat << ", alt=" << alt ); SG_LOG(SG_ENVIRONMENT, SG_DEBUG, "Recalculating magvar for lon=" << lon << ", lat=" << lat << ", alt=" << alt );
_lon = lon; _lon = lon;
_lat = lat; _lat = lat;
_alt = alt; _alt = alt;
@ -194,7 +194,7 @@ void MetarProperties::set_metar( const char * metar )
m = new FGMetar( _metar ); m = new FGMetar( _metar );
} }
catch( sg_io_exception ) { catch( sg_io_exception ) {
SG_LOG( SG_GENERAL, SG_WARN, "Can't parse metar: " << _metar ); SG_LOG( SG_ENVIRONMENT, SG_WARN, "Can't parse metar: " << _metar );
_metarValidNode->setBoolValue(false); _metarValidNode->setBoolValue(false);
return; return;
} }

View file

@ -137,7 +137,7 @@ BasicRealWxController::BasicRealWxController( SGPropertyNode_ptr rootNode ) :
PropertyList metars = rootNode->getChildren("metar"); PropertyList metars = rootNode->getChildren("metar");
for( PropertyList::size_type i = 1; i < metars.size(); i++ ) { for( PropertyList::size_type i = 1; i < metars.size(); i++ ) {
SG_LOG( SG_ALL, SG_INFO, "Adding metar properties at " << metars[i]->getStringValue() ); SG_LOG( SG_ENVIRONMENT, SG_INFO, "Adding metar properties at " << metars[i]->getStringValue() );
_metarProperties.push_back( new LiveMetarProperties( _metarProperties.push_back( new LiveMetarProperties(
fgGetNode( metars[i]->getStringValue(), true ))); fgGetNode( metars[i]->getStringValue(), true )));
} }
@ -256,7 +256,7 @@ public:
if (responseCode() == 200) { if (responseCode() == 200) {
wxController->gotMetar(stationId, metar); wxController->gotMetar(stationId, metar);
} else { } else {
SG_LOG(SG_IO, SG_WARN, "metar download failed:" << url() << ": reason:" << responseReason()); SG_LOG(SG_ENVIRONMENT, SG_WARN, "metar download failed:" << url() << ": reason:" << responseReason());
} }
} }
@ -302,23 +302,23 @@ void NoaaMetarRealWxController::update( bool first, double dt )
if( _positionTimeToLive <= 0.0 ) { if( _positionTimeToLive <= 0.0 ) {
// check nearest airport // check nearest airport
SG_LOG(SG_ALL, SG_INFO, "NoaaMetarRealWxController::update(): (re) checking nearby airport with METAR" ); SG_LOG(SG_ENVIRONMENT, SG_INFO, "NoaaMetarRealWxController::update(): (re) checking nearby airport with METAR" );
_positionTimeToLive = 60.0; _positionTimeToLive = 60.0;
SGGeod pos = SGGeod::fromDeg(_longitude_n->getDoubleValue(), _latitude_n->getDoubleValue()); SGGeod pos = SGGeod::fromDeg(_longitude_n->getDoubleValue(), _latitude_n->getDoubleValue());
FGAirport * nearestAirport = FGAirport::findClosest(pos, 10000.0, MetarAirportFilter::instance() ); FGAirport * nearestAirport = FGAirport::findClosest(pos, 10000.0, MetarAirportFilter::instance() );
if( nearestAirport == NULL ) { if( nearestAirport == NULL ) {
SG_LOG(SG_ALL,SG_WARN,"RealWxController::update can't find airport with METAR within 10000NM" ); SG_LOG(SG_ENVIRONMENT,SG_WARN,"RealWxController::update can't find airport with METAR within 10000NM" );
return; return;
} }
SG_LOG(SG_ALL, SG_INFO, SG_LOG(SG_ENVIRONMENT, SG_INFO,
"NoaaMetarRealWxController::update(): nearest airport with METAR is: " << nearestAirport->ident() ); "NoaaMetarRealWxController::update(): nearest airport with METAR is: " << nearestAirport->ident() );
// if it has changed, invalidate the associated METAR // if it has changed, invalidate the associated METAR
if( _metarProperties[0]->getStationId() != nearestAirport->ident() ) { if( _metarProperties[0]->getStationId() != nearestAirport->ident() ) {
SG_LOG(SG_ALL, SG_INFO, SG_LOG(SG_ENVIRONMENT, SG_INFO,
"NoaaMetarRealWxController::update(): nearest airport with METAR has changed. Old: '" << "NoaaMetarRealWxController::update(): nearest airport with METAR has changed. Old: '" <<
_metarProperties[0]->getStationId() << _metarProperties[0]->getStationId() <<
"', new: '" << nearestAirport->ident() << "'" ); "', new: '" << nearestAirport->ident() << "'" );
@ -335,7 +335,7 @@ void NoaaMetarRealWxController::update( bool first, double dt )
const std::string & stationId = p->getStationId(); const std::string & stationId = p->getStationId();
if( stationId.empty() ) continue; if( stationId.empty() ) continue;
SG_LOG(SG_ALL, SG_INFO, SG_LOG(SG_ENVIRONMENT, SG_INFO,
"NoaaMetarRealWxController::update(): spawning load request for station-id '" << stationId << "'" ); "NoaaMetarRealWxController::update(): spawning load request for station-id '" << stationId << "'" );
_http.makeRequest(new MetarGetRequest(this, stationId)); _http.makeRequest(new MetarGetRequest(this, stationId));
@ -345,7 +345,7 @@ void NoaaMetarRealWxController::update( bool first, double dt )
void NoaaMetarRealWxController::gotMetar(const string& stationId, const string& metar) void NoaaMetarRealWxController::gotMetar(const string& stationId, const string& metar)
{ {
SG_LOG( SG_ALL, SG_INFO, "NoaaMetarRwalWxController::update() received METAR for " << stationId << ": " << metar ); SG_LOG( SG_ENVIRONMENT, SG_INFO, "NoaaMetarRwalWxController::update() received METAR for " << stationId << ": " << metar );
BOOST_FOREACH(LiveMetarProperties* p, _metarProperties) { BOOST_FOREACH(LiveMetarProperties* p, _metarProperties) {
if (p->getStationId() != stationId) if (p->getStationId() != stationId)
continue; continue;

View file

@ -74,7 +74,12 @@ LogClassMapping log_class_mappings [] = {
LogClassMapping(SG_CLIPPER, "clipper"), LogClassMapping(SG_CLIPPER, "clipper"),
LogClassMapping(SG_NETWORK, "network"), LogClassMapping(SG_NETWORK, "network"),
LogClassMapping(SG_INSTR, "instrumentation"), LogClassMapping(SG_INSTR, "instrumentation"),
LogClassMapping(SG_ATC, "atc"),
LogClassMapping(SG_NASAL, "nasal"),
LogClassMapping(SG_SYSTEMS, "systems"), LogClassMapping(SG_SYSTEMS, "systems"),
LogClassMapping(SG_AI, "ai"),
LogClassMapping(SG_ENVIRONMENT, "environment"),
LogClassMapping(SG_SOUND, "sound"),
LogClassMapping(SG_UNDEFD, "") LogClassMapping(SG_UNDEFD, "")
}; };

View file

@ -66,7 +66,7 @@ FGLogger::init ()
log.delimiter = delimiter.c_str()[0]; log.delimiter = delimiter.c_str()[0];
log.output = new ofstream(filename.c_str()); log.output = new ofstream(filename.c_str());
if (!log.output) { if (!log.output) {
SG_LOG(SG_INPUT, SG_ALERT, "Cannot write log to " << filename); SG_LOG(SG_GENERAL, SG_ALERT, "Cannot write log to " << filename);
continue; continue;
} }

View file

@ -134,8 +134,8 @@ static void fgMainLoop( void ) {
frame_signal->fireValueChanged(); frame_signal->fireValueChanged();
SGCloudLayer::enable_bump_mapping = fgGetBool("/sim/rendering/bump-mapping"); SGCloudLayer::enable_bump_mapping = fgGetBool("/sim/rendering/bump-mapping");
SG_LOG( SG_ALL, SG_DEBUG, "Running Main Loop"); SG_LOG( SG_GENERAL, SG_DEBUG, "Running Main Loop");
SG_LOG( SG_ALL, SG_DEBUG, "======= ==== ===="); SG_LOG( SG_GENERAL, SG_DEBUG, "======= ==== ====");
// update "time" // update "time"
@ -242,7 +242,7 @@ static void fgMainLoop( void ) {
simgear::AtomicChangeListener::fireChangeListeners(); simgear::AtomicChangeListener::fireChangeListeners();
SG_LOG( SG_ALL, SG_DEBUG, "" ); SG_LOG( SG_GENERAL, SG_DEBUG, "" );
} }
void fgInitSoundManager() void fgInitSoundManager()

View file

@ -279,9 +279,9 @@ FGTileMgr::loadTileModel(const string& modelPath, bool cacheModel)
string m(exc.getMessage()); string m(exc.getMessage());
m += " "; m += " ";
m += exc.getLocation().asString(); m += exc.getLocation().asString();
SG_LOG( SG_ALL, SG_ALERT, m ); SG_LOG( SG_TERRAIN, SG_ALERT, m );
} catch (const sg_exception& exc) { // XXX may be redundant } catch (const sg_exception& exc) { // XXX may be redundant
SG_LOG( SG_ALL, SG_ALERT, exc.getMessage()); SG_LOG( SG_TERRAIN, SG_ALERT, exc.getMessage());
} }
return result; return result;
} }
@ -330,7 +330,7 @@ void FGTileMgr::update_queues()
} }
} else } else
{ {
SG_LOG(SG_INPUT, SG_ALERT, "Warning: empty tile in cache!"); SG_LOG(SG_TERRAIN, SG_ALERT, "Warning: empty tile in cache!");
} }
tile_cache.next(); tile_cache.next();
sz++; sz++;

View file

@ -99,7 +99,7 @@ bool FGBeacon::init() {
outer->set_reference_dist( 10.0 ); outer->set_reference_dist( 10.0 );
outer->set_max_dist( 20.0 ); outer->set_max_dist( 20.0 );
} catch ( sg_io_exception &e ) { } catch ( sg_io_exception &e ) {
SG_LOG(SG_GENERAL, SG_ALERT, e.getFormattedMessage()); SG_LOG(SG_SOUND, SG_ALERT, e.getFormattedMessage());
} }
return true; return true;

View file

@ -71,19 +71,19 @@ FGFX::init()
string path_str = node->getStringValue("path"); string path_str = node->getStringValue("path");
if (path_str.empty()) { if (path_str.empty()) {
SG_LOG(SG_GENERAL, SG_ALERT, "No path in /sim/sound/path"); SG_LOG(SG_SOUND, SG_ALERT, "No path in /sim/sound/path");
return; return;
} }
SGPath path = globals->resolve_aircraft_path(path_str); SGPath path = globals->resolve_aircraft_path(path_str);
SG_LOG(SG_GENERAL, SG_INFO, "Reading sound " << node->getName() SG_LOG(SG_SOUND, SG_INFO, "Reading sound " << node->getName()
<< " from " << path.str()); << " from " << path.str());
SGPropertyNode root; SGPropertyNode root;
try { try {
readProperties(path.str(), &root); readProperties(path.str(), &root);
} catch (const sg_exception &) { } catch (const sg_exception &) {
SG_LOG(SG_GENERAL, SG_ALERT, SG_LOG(SG_SOUND, SG_ALERT,
"Error reading file '" << path.str() << '\''); "Error reading file '" << path.str() << '\'');
return; return;
} }
@ -99,7 +99,7 @@ FGFX::init()
_sound.push_back(sound); _sound.push_back(sound);
} catch ( sg_exception &e ) { } catch ( sg_exception &e ) {
SG_LOG(SG_GENERAL, SG_ALERT, e.getFormattedMessage()); SG_LOG(SG_SOUND, SG_ALERT, e.getFormattedMessage());
delete sound; delete sound;
} }
} }

View file

@ -68,7 +68,7 @@ void FGVoiceMgr::init()
for (unsigned int i = 0; i < voices.size(); i++) for (unsigned int i = 0; i < voices.size(); i++)
_voices.push_back(new FGVoice(this, voices[i])); _voices.push_back(new FGVoice(this, voices[i]));
} catch (const string& s) { } catch (const string& s) {
SG_LOG(SG_IO, SG_ALERT, "VOICE: " << s); SG_LOG(SG_SOUND, SG_ALERT, "VOICE: " << s);
} }
#if defined(ENABLE_THREADS) #if defined(ENABLE_THREADS)
@ -105,7 +105,7 @@ FGVoiceMgr::FGVoice::FGVoice(FGVoiceMgr *mgr, const SGPropertyNode_ptr node) :
_festival(node->getBoolValue("festival", true)), _festival(node->getBoolValue("festival", true)),
_mgr(mgr) _mgr(mgr)
{ {
SG_LOG(SG_IO, SG_INFO, "VOICE: adding `" << node->getStringValue("desc", "<unnamed>") SG_LOG(SG_SOUND, SG_INFO, "VOICE: adding `" << node->getStringValue("desc", "<unnamed>")
<< "' voice"); << "' voice");
const string &host = _mgr->_host; const string &host = _mgr->_host;
const string &port = _mgr->_port; const string &port = _mgr->_port;
@ -124,7 +124,7 @@ FGVoiceMgr::FGVoice::FGVoice(FGVoiceMgr *mgr, const SGPropertyNode_ptr node) :
+ "'. Either it's not\n Festival listening," + "'. Either it's not\n Festival listening,"
" or Festival couldn't open a sound device."; " or Festival couldn't open a sound device.";
SG_LOG(SG_IO, SG_INFO, "VOICE: connection to Festival server on `" SG_LOG(SG_SOUND, SG_INFO, "VOICE: connection to Festival server on `"
<< host << ':' << port << "' established"); << host << ':' << port << "' established");
setVolume(_volume = _volumeNode->getDoubleValue()); setVolume(_volume = _volumeNode->getDoubleValue());

View file

@ -214,7 +214,7 @@ FGVoicePlayer::get_sample (const char *name)
} }
catch (const sg_exception &e) catch (const sg_exception &e)
{ {
SG_LOG(SG_INSTR, SG_ALERT, "Error loading sound sample \"" + filename + "\": " + e.getFormattedMessage()); SG_LOG(SG_SOUND, SG_ALERT, "Error loading sound sample \"" + filename + "\": " + e.getFormattedMessage());
exit(1); exit(1);
} }

View file

@ -119,7 +119,7 @@ float FGElectricalSupplier::apply_load( float amps, float dt ) {
float available_amps = ideal_amps; float available_amps = ideal_amps;
return available_amps - amps; return available_amps - amps;
} else { } else {
SG_LOG( SG_ALL, SG_ALERT, "unknown supplier type" ); SG_LOG( SG_SYSTEMS, SG_ALERT, "unknown supplier type" );
} }
return 0.0; return 0.0;
@ -151,7 +151,7 @@ float FGElectricalSupplier::get_output_volts() {
// cout << "external amps = " << 0.0 << endl; // cout << "external amps = " << 0.0 << endl;
return ideal_volts; return ideal_volts;
} else { } else {
SG_LOG( SG_ALL, SG_ALERT, "unknown supplier type" ); SG_LOG( SG_SYSTEMS, SG_ALERT, "unknown supplier type" );
} }
return 0.0; return 0.0;
@ -180,7 +180,7 @@ float FGElectricalSupplier::get_output_amps() {
// cout << "external amps = " << 0.0 << endl; // cout << "external amps = " << 0.0 << endl;
return ideal_amps; return ideal_amps;
} else { } else {
SG_LOG( SG_ALL, SG_ALERT, "unknown supplier type" ); SG_LOG( SG_SYSTEMS, SG_ALERT, "unknown supplier type" );
} }
return 0.0; return 0.0;
@ -274,12 +274,12 @@ FGElectricalConnector::FGElectricalConnector ( SGPropertyNode *node,
} else if ( s->get_kind() == FG_BUS ) { } else if ( s->get_kind() == FG_BUS ) {
s->add_output( this ); s->add_output( this );
} else { } else {
SG_LOG( SG_ALL, SG_ALERT, SG_LOG( SG_SYSTEMS, SG_ALERT,
"Attempt to connect to something that can't provide an output: " "Attempt to connect to something that can't provide an output: "
<< child->getStringValue() ); << child->getStringValue() );
} }
} else { } else {
SG_LOG( SG_ALL, SG_ALERT, "Can't find named source: " SG_LOG( SG_SYSTEMS, SG_ALERT, "Can't find named source: "
<< child->getStringValue() ); << child->getStringValue() );
} }
} else if ( cname == "output" ) { } else if ( cname == "output" ) {
@ -295,12 +295,12 @@ FGElectricalConnector::FGElectricalConnector ( SGPropertyNode *node,
== FGElectricalSupplier::FG_BATTERY ) { == FGElectricalSupplier::FG_BATTERY ) {
s->add_output( this ); s->add_output( this );
} else { } else {
SG_LOG( SG_ALL, SG_ALERT, SG_LOG( SG_SYSTEMS, SG_ALERT,
"Attempt to connect to something that can't provide an input: " "Attempt to connect to something that can't provide an input: "
<< child->getStringValue() ); << child->getStringValue() );
} }
} else { } else {
SG_LOG( SG_ALL, SG_ALERT, "Can't find named source: " SG_LOG( SG_SYSTEMS, SG_ALERT, "Can't find named source: "
<< child->getStringValue() ); << child->getStringValue() );
} }
} else if ( cname == "switch" ) { } else if ( cname == "switch" ) {
@ -362,7 +362,7 @@ void FGElectricalSystem::init () {
SGPropertyNode *path_n = fgGetNode("/sim/systems/electrical/path"); SGPropertyNode *path_n = fgGetNode("/sim/systems/electrical/path");
if ( path_n ) { if ( path_n ) {
if ( path.length() ) { if ( path.length() ) {
SG_LOG( SG_ALL, SG_INFO, SG_LOG( SG_SYSTEMS, SG_INFO,
"NOTICE: System manager configuration specifies an " << "NOTICE: System manager configuration specifies an " <<
"electrical system: " << path << " but it is " << "electrical system: " << path << " but it is " <<
"being overridden by the one specified in the -set.xml " << "being overridden by the one specified in the -set.xml " <<
@ -376,7 +376,7 @@ void FGElectricalSystem::init () {
SGPath config = globals->resolve_aircraft_path(path); SGPath config = globals->resolve_aircraft_path(path);
// load an obsolete xml configuration // load an obsolete xml configuration
SG_LOG( SG_ALL, SG_WARN, SG_LOG( SG_SYSTEMS, SG_WARN,
"Reading deprecated xml electrical system model from\n " "Reading deprecated xml electrical system model from\n "
<< config.str() ); << config.str() );
try { try {
@ -385,21 +385,21 @@ void FGElectricalSystem::init () {
if ( build(config_props) ) { if ( build(config_props) ) {
enabled = true; enabled = true;
} else { } else {
SG_LOG( SG_ALL, SG_ALERT, SG_LOG( SG_SYSTEMS, SG_ALERT,
"Detected a logic error in the electrical system "); "Detected a logic error in the electrical system ");
SG_LOG( SG_ALL, SG_ALERT, SG_LOG( SG_SYSTEMS, SG_ALERT,
"specification file. See earlier errors for " ); "specification file. See earlier errors for " );
SG_LOG( SG_ALL, SG_ALERT, SG_LOG( SG_SYSTEMS, SG_ALERT,
"details."); "details.");
exit(-1); exit(-1);
} }
} catch (const sg_exception&) { } catch (const sg_exception&) {
SG_LOG( SG_ALL, SG_ALERT, SG_LOG( SG_SYSTEMS, SG_ALERT,
"Failed to load electrical system model: " "Failed to load electrical system model: "
<< config.str() ); << config.str() );
} }
} else { } else {
SG_LOG( SG_ALL, SG_INFO, SG_LOG( SG_SYSTEMS, SG_INFO,
"No xml-based electrical model specified for this model!"); "No xml-based electrical model specified for this model!");
} }
@ -455,7 +455,7 @@ void FGElectricalSystem::update (double dt) {
" " ); " " );
if ( node->apply_load( load, dt ) < 0.0 ) { if ( node->apply_load( load, dt ) < 0.0 ) {
SG_LOG(SG_ALL, SG_ALERT, SG_LOG(SG_SYSTEMS, SG_ALERT,
"Error drawing more current than available!"); "Error drawing more current than available!");
} }
} }
@ -475,7 +475,7 @@ void FGElectricalSystem::update (double dt) {
" " ); " " );
if ( node->apply_load( load, dt ) < 0.0 ) { if ( node->apply_load( load, dt ) < 0.0 ) {
SG_LOG(SG_ALL, SG_ALERT, SG_LOG(SG_SYSTEMS, SG_ALERT,
"Error drawing more current than available!"); "Error drawing more current than available!");
} }
} }
@ -496,7 +496,7 @@ void FGElectricalSystem::update (double dt) {
// cout << "battery load = " << load << endl; // cout << "battery load = " << load << endl;
if ( node->apply_load( load, dt ) < 0.0 ) { if ( node->apply_load( load, dt ) < 0.0 ) {
SG_LOG(SG_ALL, SG_ALERT, SG_LOG(SG_SYSTEMS, SG_ALERT,
"Error drawing more current than available!"); "Error drawing more current than available!");
} }
} }
@ -579,7 +579,7 @@ bool FGElectricalSystem::build (SGPropertyNode* config_props) {
new FGElectricalConnector( node, this ); new FGElectricalConnector( node, this );
connectors.push_back( c ); connectors.push_back( c );
} else { } else {
SG_LOG( SG_ALL, SG_ALERT, "Unknown component type specified: " SG_LOG( SG_SYSTEMS, SG_ALERT, "Unknown component type specified: "
<< name ); << name );
return false; return false;
} }
@ -637,7 +637,7 @@ float FGElectricalSystem::propagate( FGElectricalComponent *node, double dt,
} }
// cout << s << " input_volts = " << volts << endl; // cout << s << " input_volts = " << volts << endl;
} else { } else {
SG_LOG( SG_ALL, SG_ALERT, "unkown node type" ); SG_LOG( SG_SYSTEMS, SG_ALERT, "unkown node type" );
} }
int i; int i;

View file

@ -36,7 +36,7 @@ FGSystemMgr::FGSystemMgr ()
if (path_n) { if (path_n) {
SGPath config = globals->resolve_aircraft_path(path_n->getStringValue()); SGPath config = globals->resolve_aircraft_path(path_n->getStringValue());
SG_LOG( SG_ALL, SG_INFO, "Reading systems from " SG_LOG( SG_SYSTEMS, SG_INFO, "Reading systems from "
<< config.str() ); << config.str() );
try { try {
readProperties( config.str(), config_props ); readProperties( config.str(), config_props );
@ -44,21 +44,21 @@ FGSystemMgr::FGSystemMgr ()
if ( build(config_props) ) { if ( build(config_props) ) {
enabled = true; enabled = true;
} else { } else {
SG_LOG( SG_ALL, SG_ALERT, SG_LOG( SG_SYSTEMS, SG_ALERT,
"Detected an internal inconsistency in the systems"); "Detected an internal inconsistency in the systems");
SG_LOG( SG_ALL, SG_ALERT, SG_LOG( SG_SYSTEMS, SG_ALERT,
" system specification file. See earlier errors for" ); " system specification file. See earlier errors for" );
SG_LOG( SG_ALL, SG_ALERT, SG_LOG( SG_SYSTEMS, SG_ALERT,
" details."); " details.");
exit(-1); exit(-1);
} }
} catch (const sg_exception&) { } catch (const sg_exception&) {
SG_LOG( SG_ALL, SG_ALERT, "Failed to load systems system model: " SG_LOG( SG_SYSTEMS, SG_ALERT, "Failed to load systems system model: "
<< config.str() ); << config.str() );
} }
} else { } else {
SG_LOG( SG_ALL, SG_WARN, SG_LOG( SG_SYSTEMS, SG_WARN,
"No systems model specified for this model!"); "No systems model specified for this model!");
} }
@ -92,7 +92,7 @@ bool FGSystemMgr::build (SGPropertyNode* config_props)
set_subsystem( "system" + temp.str(), set_subsystem( "system" + temp.str(),
new VacuumSystem( node ) ); new VacuumSystem( node ) );
} else { } else {
SG_LOG( SG_ALL, SG_ALERT, "Unknown top level section: " SG_LOG( SG_SYSTEMS, SG_ALERT, "Unknown top level section: "
<< name ); << name );
return false; return false;
} }