1
0
Fork 0

Use more specific log classes.

Log class filters work better when different modules
use different classes :).
This commit is contained in:
ThorstenB 2011-10-11 21:55:50 +02:00
parent 53e6c0ac5f
commit b16338598a
9 changed files with 58 additions and 56 deletions

View file

@ -970,7 +970,7 @@ void FGAIBallistic::handle_impact() {
return;
if (_ht_agl_ft <= 0) {
SG_LOG(SG_GENERAL, SG_DEBUG, "AIBallistic: terrain impact material" << _mat_name);
SG_LOG(SG_AI, SG_DEBUG, "AIBallistic: terrain impact material" << _mat_name);
report_impact(_elevation_m);
_impact_reported = true;
@ -983,7 +983,7 @@ void FGAIBallistic::handle_impact() {
void FGAIBallistic::handle_expiry() {
//SG_LOG(SG_GENERAL, SG_DEBUG, "AIBallistic: handle_expiry " << pos.getElevationM());
//SG_LOG(SG_AI, SG_DEBUG, "AIBallistic: handle_expiry " << pos.getElevationM());
report_impact(pos.getElevationM());
_expiry_reported = true;
@ -1024,7 +1024,7 @@ void FGAIBallistic::report_impact(double elevation, const FGAIBase *object)
else
n->setStringValue("type", "terrain");
SG_LOG(SG_GENERAL, SG_DEBUG, "AIBallistic: object impact " << _name
SG_LOG(SG_AI, SG_DEBUG, "AIBallistic: object impact " << _name
<< " lon " <<_impact_lon << " lat " <<_impact_lat << " sec " << _life_timer);
n->setDoubleValue("longitude-deg", _impact_lon);

View file

@ -296,7 +296,7 @@ bool FGAIBase::init(bool search_in_AI_path) {
_initialized = true;
} else if (!model_path.empty()) {
SG_LOG(SG_INPUT, SG_WARN, "AIBase: Could not load model " << model_path);
SG_LOG(SG_AI, SG_WARN, "AIBase: Could not load model " << model_path);
// not properly installed...
_installed = false;
}
@ -311,7 +311,7 @@ void FGAIBase::initModel(osg::Node *node)
if( _path != ""){
props->setStringValue("submodels/path", _path.c_str());
SG_LOG(SG_INPUT, SG_DEBUG, "AIBase: submodels/path " << _path);
SG_LOG(SG_AI, SG_DEBUG, "AIBase: submodels/path " << _path);
}
if( _parent!= ""){
@ -320,7 +320,7 @@ void FGAIBase::initModel(osg::Node *node)
fgSetString("/ai/models/model-added", props->getPath().c_str());
} else if (!model_path.empty()) {
SG_LOG(SG_INPUT, SG_WARN, "AIBase: Could not load model " << model_path);
SG_LOG(SG_AI, SG_WARN, "AIBase: Could not load model " << model_path);
}
setDie(false);
@ -609,7 +609,7 @@ void FGAIBase::_setSubID( int s ) {
bool FGAIBase::setParentNode() {
if (_parent == ""){
SG_LOG(SG_GENERAL, SG_ALERT, "AIBase: " << _name
SG_LOG(SG_AI, SG_ALERT, "AIBase: " << _name
<< " parent not set ");
return false;
}
@ -644,7 +644,7 @@ bool FGAIBase::setParentNode() {
const string name = _selected_ac->getStringValue("name");
return true;
} else {
SG_LOG(SG_GENERAL, SG_ALERT, "AIBase: " << _name
SG_LOG(SG_AI, SG_ALERT, "AIBase: " << _name
<< " parent not found: dying ");
setDie(true);
return false;

View file

@ -134,7 +134,7 @@ void FGAICarrier::update(double dt) {
FGAIShip::update(dt);
//automatic turn into wind with a target wind of 25 kts otd
//SG_LOG(SG_GENERAL, SG_ALERT, "AICarrier: MPControl " << MPControl << " AIControl " << AIControl);
//SG_LOG(SG_AI, SG_ALERT, "AICarrier: MPControl " << MPControl << " AIControl " << AIControl);
if (!MPControl && AIControl){
if(turn_to_launch_hdg){
@ -496,7 +496,7 @@ void FGAICarrier::ReturnToBox(){
bool FGAICarrier::OutsideBox() { //returns true if the carrier is outside operating box
if ( max_lat == 0 && min_lat == 0 && max_long == 0 && min_long == 0) {
SG_LOG(SG_GENERAL, SG_DEBUG, "AICarrier: No Operating Box defined" );
SG_LOG(SG_AI, SG_DEBUG, "AICarrier: No Operating Box defined" );
return false;
}
@ -530,7 +530,7 @@ bool FGAICarrier::OutsideBox() { //returns true if the carrier is outside operat
return true;
}
SG_LOG(SG_GENERAL, SG_DEBUG, "AICarrier: Inside Operating Box" );
SG_LOG(SG_AI, SG_DEBUG, "AICarrier: Inside Operating Box" );
return false;
} // end OutsideBox

View file

@ -314,7 +314,7 @@ void FGAIEscort::setStationSpeed(){
// these are the AI rules for the manoeuvring of escorts
if (_MPControl && _tgtrange > 4 * _stn_limit){
SG_LOG(SG_GENERAL, SG_ALERT, "AIEscort: " << _name
SG_LOG(SG_AI, SG_ALERT, "AIEscort: " << _name
<< " re-aligning to MP pos");
pos = _tgtpos;
speed = 0;

View file

@ -166,7 +166,7 @@ bool FGAIGroundVehicle::init(bool search_in_AI_path) {
}
void FGAIGroundVehicle::update(double dt) {
// SG_LOG(SG_GENERAL, SG_ALERT, "updating GroundVehicle: " << _name );
// SG_LOG(SG_AI, SG_ALERT, "updating GroundVehicle: " << _name );
FGAIShip::update(dt);
RunGroundVehicle(dt);
@ -386,11 +386,11 @@ void FGAIGroundVehicle::AdvanceFP(){
string parent_next_name =_selected_ac->getStringValue("waypoint/name-next");
while(fp->getNextWaypoint() != 0 && fp->getNextWaypoint()->getName() != "END" && count < 5){
SG_LOG(SG_GENERAL, SG_DEBUG, "AIGroundVeh1cle: " << _name
SG_LOG(SG_AI, SG_DEBUG, "AIGroundVeh1cle: " << _name
<<" advancing waypoint to: " << parent_next_name);
if (fp->getNextWaypoint()->getName() == parent_next_name){
SG_LOG(SG_GENERAL, SG_DEBUG, "AIGroundVeh1cle: " << _name
SG_LOG(SG_AI, SG_DEBUG, "AIGroundVeh1cle: " << _name
<< " not setting waypoint already at: " << fp->getNextWaypoint()->getName());
return;
}
@ -401,7 +401,7 @@ void FGAIGroundVehicle::AdvanceFP(){
next = fp->getNextWaypoint();
if (fp->getNextWaypoint()->getName() == parent_next_name){
SG_LOG(SG_GENERAL, SG_DEBUG, "AIGroundVeh1cle: " << _name
SG_LOG(SG_AI, SG_DEBUG, "AIGroundVeh1cle: " << _name
<< " waypoint set to: " << fp->getNextWaypoint()->getName());
return;
}
@ -412,12 +412,12 @@ void FGAIGroundVehicle::AdvanceFP(){
while(fp->getPreviousWaypoint() != 0 && fp->getPreviousWaypoint()->getName() != "END"
&& count > -10){
SG_LOG(SG_GENERAL, SG_DEBUG, "AIGroundVeh1cle: " << _name
SG_LOG(SG_AI, SG_DEBUG, "AIGroundVeh1cle: " << _name
<< " retreating waypoint to: " << parent_next_name
<< " at: " << fp->getNextWaypoint()->getName());
if (fp->getNextWaypoint()->getName() == parent_next_name){
SG_LOG(SG_GENERAL, SG_DEBUG, "AIGroundVeh1cle: " << _name
SG_LOG(SG_AI, SG_DEBUG, "AIGroundVeh1cle: " << _name
<< " not setting waypoint already at:" << fp->getNextWaypoint()->getName() );
return;
}
@ -428,7 +428,7 @@ void FGAIGroundVehicle::AdvanceFP(){
next = fp->getNextWaypoint();
if (fp->getNextWaypoint()->getName() == parent_next_name){
SG_LOG(SG_GENERAL, SG_DEBUG, "AIGroundVeh1cle: " << _name
SG_LOG(SG_AI, SG_DEBUG, "AIGroundVeh1cle: " << _name
<< " waypoint set to: " << fp->getNextWaypoint()->getName());
return;
}
@ -500,7 +500,7 @@ void FGAIGroundVehicle::RunGroundVehicle(double dt){
//bool parent_restart = _selected_ac->getBoolValue("controls/restart");
if (parent_next_name == "END" && fp->getNextWaypoint()->getName() != "END" ){
SG_LOG(SG_GENERAL, SG_DEBUG, "AIGroundVeh1cle: " << _name
SG_LOG(SG_AI, SG_DEBUG, "AIGroundVeh1cle: " << _name
<< " setting END: getting new waypoints ");
AdvanceFP();
setWPNames();
@ -508,13 +508,13 @@ void FGAIGroundVehicle::RunGroundVehicle(double dt){
if(_restart) _missed_count = 200;
/*} else if (parent_next_name == "WAIT" && fp->getNextWaypoint()->name != "WAIT" ){*/
} else if (parent_waiting && !_waiting){
SG_LOG(SG_GENERAL, SG_DEBUG, "AIGroundVeh1cle: " << _name
SG_LOG(SG_AI, SG_DEBUG, "AIGroundVeh1cle: " << _name
<< " setting WAIT/WAITUNTIL: getting new waypoints ");
AdvanceFP();
setWPNames();
_waiting = true;
} else if (parent_next_name != "WAIT" && fp->getNextWaypoint()->getName() == "WAIT"){
SG_LOG(SG_GENERAL, SG_DEBUG, "AIGroundVeh1cle: " << _name
SG_LOG(SG_AI, SG_DEBUG, "AIGroundVeh1cle: " << _name
<< " wait done: getting new waypoints ");
_waiting = false;
_wait_count = 0;
@ -533,7 +533,7 @@ void FGAIGroundVehicle::RunGroundVehicle(double dt){
setWPNames();
} else if (_range_ft > (_x_offset +_parent_x_offset)* 4
){
SG_LOG(SG_GENERAL, SG_ALERT, "AIGroundVeh1cle: " << _name
SG_LOG(SG_AI, SG_ALERT, "AIGroundVeh1cle: " << _name
<< " rescue: reforming train " << _range_ft
);

View file

@ -151,7 +151,7 @@ void FGAIMultiplayer::update(double dt)
if ((!mAllowExtrapolation && offset + lag < mTimeOffset)
|| (offset - 10 > mTimeOffset)) {
mTimeOffset = offset;
SG_LOG(SG_GENERAL, SG_DEBUG, "Resetting time offset adjust system to "
SG_LOG(SG_AI, SG_DEBUG, "Resetting time offset adjust system to "
"avoid extrapolation: time offset = " << mTimeOffset);
} else {
// the error of the offset, respectively the negative error to avoid
@ -178,7 +178,7 @@ void FGAIMultiplayer::update(double dt)
systemIncrement = err;
mTimeOffset += systemIncrement;
SG_LOG(SG_GENERAL, SG_DEBUG, "Offset adjust system: time offset = "
SG_LOG(SG_AI, SG_DEBUG, "Offset adjust system: time offset = "
<< mTimeOffset << ", expected longitudinal position error due to "
" current adjustment of the offset: "
<< fabs(norm(it->second.linearVel)*systemIncrement));
@ -200,7 +200,7 @@ void FGAIMultiplayer::update(double dt)
// Find the first packet before the target time
MotionInfo::iterator nextIt = mMotionInfo.upper_bound(tInterp);
if (nextIt == mMotionInfo.begin()) {
SG_LOG(SG_GENERAL, SG_DEBUG, "Taking oldest packet!");
SG_LOG(SG_AI, SG_DEBUG, "Taking oldest packet!");
// We have no packet before the target time, just use the first one
MotionInfo::iterator firstIt = mMotionInfo.begin();
ecPos = firstIt->second.position;
@ -243,7 +243,7 @@ void FGAIMultiplayer::update(double dt)
}
else
{
SG_LOG(SG_GENERAL, SG_DEBUG, "Unable to find property: " << (*firstPropIt)->id << "\n");
SG_LOG(SG_AI, SG_DEBUG, "Unable to find property: " << (*firstPropIt)->id << "\n");
}
++firstPropIt;
}
@ -260,7 +260,7 @@ void FGAIMultiplayer::update(double dt)
double intervalLen = intervalEnd - intervalStart;
double tau = (tInterp - intervalStart)/intervalLen;
SG_LOG(SG_GENERAL, SG_DEBUG, "Multiplayer vehicle interpolation: ["
SG_LOG(SG_AI, SG_DEBUG, "Multiplayer vehicle interpolation: ["
<< intervalStart << ", " << intervalEnd << "], intervalLen = "
<< intervalLen << ", interpolation parameter = " << tau);
@ -323,7 +323,7 @@ void FGAIMultiplayer::update(double dt)
}
else
{
SG_LOG(SG_GENERAL, SG_DEBUG, "Unable to find property: " << (*prevPropIt)->id << "\n");
SG_LOG(SG_AI, SG_DEBUG, "Unable to find property: " << (*prevPropIt)->id << "\n");
}
++prevPropIt;
@ -347,7 +347,7 @@ void FGAIMultiplayer::update(double dt)
double t = tInterp - motionInfo.time;
t = SGMisc<double>::min(t, 5);
SG_LOG(SG_GENERAL, SG_DEBUG, "Multiplayer vehicle extrapolation: "
SG_LOG(SG_AI, SG_DEBUG, "Multiplayer vehicle extrapolation: "
"extrapolation time = " << t);
// Do a few explicit euler steps with the constant acceleration's
@ -408,7 +408,7 @@ void FGAIMultiplayer::update(double dt)
}
else
{
SG_LOG(SG_GENERAL, SG_DEBUG, "Unable to find property: " << (*firstPropIt)->id << "\n");
SG_LOG(SG_AI, SG_DEBUG, "Unable to find property: " << (*firstPropIt)->id << "\n");
}
++firstPropIt;
@ -444,7 +444,7 @@ void FGAIMultiplayer::update(double dt)
roll = rDeg;
pitch = pDeg;
SG_LOG(SG_GENERAL, SG_DEBUG, "Multiplayer position and orientation: "
SG_LOG(SG_AI, SG_DEBUG, "Multiplayer position and orientation: "
<< ecPos << ", " << hlOr);
//###########################//

View file

@ -103,7 +103,7 @@ void FGAIShip::readFromScenario(SGPropertyNode* scFileNode) {
setSMPath(scFileNode->getStringValue("submodel-path", ""));
if (!flightplan.empty()) {
SG_LOG(SG_GENERAL, SG_ALERT, "getting flightplan: " << _name );
SG_LOG(SG_AI, SG_ALERT, "getting flightplan: " << _name );
FGAIFlightPlan* fp = new FGAIFlightPlan(flightplan);
setFlightPlan(fp);
@ -245,7 +245,7 @@ void FGAIShip::unbind() {
}
void FGAIShip::update(double dt) {
//SG_LOG(SG_GENERAL, SG_ALERT, "updating Ship: " << _name <<hdg<<pitch<<roll);
//SG_LOG(SG_AI, SG_ALERT, "updating Ship: " << _name <<hdg<<pitch<<roll);
// For computation of rotation speeds we just use finite differences here.
// That is perfectly valid since this thing is not driven by accelerations
// but by just apply discrete changes at its velocity variables.
@ -580,7 +580,7 @@ void FGAIShip::setWPNames() {
setCurrName(curr->getName());
else{
setCurrName("");
SG_LOG(SG_GENERAL, SG_ALERT, "AIShip: current wp name error" );
SG_LOG(SG_AI, SG_ALERT, "AIShip: current wp name error" );
}
if (next != 0)
@ -588,9 +588,9 @@ void FGAIShip::setWPNames() {
else
setNextName("");
SG_LOG(SG_GENERAL, SG_DEBUG, "AIShip: prev wp name " << prev->getName());
SG_LOG(SG_GENERAL, SG_DEBUG, "AIShip: current wp name " << curr->getName());
SG_LOG(SG_GENERAL, SG_DEBUG, "AIShip: next wp name " << next->getName());
SG_LOG(SG_AI, SG_DEBUG, "AIShip: prev wp name " << prev->getName());
SG_LOG(SG_AI, SG_DEBUG, "AIShip: current wp name " << curr->getName());
SG_LOG(SG_AI, SG_DEBUG, "AIShip: next wp name " << next->getName());
}
@ -612,10 +612,10 @@ double FGAIShip::getCourse(double lat, double lon, double lat2, double lon2) con
geo_inverse_wgs_84(lat, lon, lat2, lon2, &course, &recip, &distance);
if (tgt_speed >= 0) {
return course;
SG_LOG(SG_GENERAL, SG_DEBUG, "AIShip: course " << course);
SG_LOG(SG_AI, SG_DEBUG, "AIShip: course " << course);
} else {
return recip;
SG_LOG(SG_GENERAL, SG_DEBUG, "AIShip: recip " << recip);
SG_LOG(SG_AI, SG_DEBUG, "AIShip: recip " << recip);
}
}
@ -682,7 +682,7 @@ void FGAIShip::ProcessFlightPlan(double dt) {
if (_next_name == "TUNNEL"){
_tunnel = !_tunnel;
SG_LOG(SG_GENERAL, SG_DEBUG, "AIShip: " << _name << " " << sp_turn_radius_nm );
SG_LOG(SG_AI, SG_DEBUG, "AIShip: " << _name << " " << sp_turn_radius_nm );
fp->IncrementWaypoint(false);
next = fp->getNextWaypoint();
@ -699,7 +699,7 @@ void FGAIShip::ProcessFlightPlan(double dt) {
}else if(_next_name == "END" || fp->getNextWaypoint() == 0) {
if (_repeat) {
SG_LOG(SG_GENERAL, SG_INFO, "AIShip: "<< _name << " Flightplan repeating ");
SG_LOG(SG_AI, SG_INFO, "AIShip: "<< _name << " Flightplan repeating ");
fp->restart();
prev = curr;
curr = fp->getCurrentWaypoint();
@ -713,11 +713,11 @@ void FGAIShip::ProcessFlightPlan(double dt) {
_lead_angle = 0;
AccelTo(prev->getSpeed());
} else if (_restart){
SG_LOG(SG_GENERAL, SG_INFO, "AIShip: " << _name << " Flightplan restarting ");
SG_LOG(SG_AI, SG_INFO, "AIShip: " << _name << " Flightplan restarting ");
_missed_count = 0;
initFlightPlan();
} else {
SG_LOG(SG_GENERAL, SG_ALERT, "AIShip: " << _name << " Flightplan dying ");
SG_LOG(SG_AI, SG_ALERT, "AIShip: " << _name << " Flightplan dying ");
setDie(true);
_dt_count = 0;
return;
@ -726,7 +726,7 @@ void FGAIShip::ProcessFlightPlan(double dt) {
} else if (_next_name == "WAIT") {
if (_wait_count < next->getTime_sec()) {
SG_LOG(SG_GENERAL, SG_DEBUG, "AIShip: " << _name << " waiting ");
SG_LOG(SG_AI, SG_DEBUG, "AIShip: " << _name << " waiting ");
setSpeed(0);
_waiting = true;
_wait_count += _dt_count;
@ -734,7 +734,7 @@ void FGAIShip::ProcessFlightPlan(double dt) {
_lead_angle = 0;
return;
} else {
SG_LOG(SG_GENERAL, SG_DEBUG, "AIShip: " << _name
SG_LOG(SG_AI, SG_DEBUG, "AIShip: " << _name
<< " wait done: getting new waypoints ");
_waiting = false;
_wait_count = 0;
@ -757,7 +757,7 @@ void FGAIShip::ProcessFlightPlan(double dt) {
_until_time = next->getTime();
setUntilTime(next->getTime());
if (until_time_sec > time_sec) {
SG_LOG(SG_GENERAL, SG_INFO, "AIShip: " << _name << " "
SG_LOG(SG_AI, SG_INFO, "AIShip: " << _name << " "
<< curr->getName() << " waiting until: "
<< _until_time << " " << until_time_sec << " now " << time_sec );
setSpeed(0);
@ -765,7 +765,7 @@ void FGAIShip::ProcessFlightPlan(double dt) {
_waiting = true;
return;
} else {
SG_LOG(SG_GENERAL, SG_INFO, "AIShip: "
SG_LOG(SG_AI, SG_INFO, "AIShip: "
<< _name << " wait until done: getting new waypoints ");
setUntilTime("");
fp->IncrementWaypoint(false);
@ -787,7 +787,7 @@ void FGAIShip::ProcessFlightPlan(double dt) {
} else {
//now reorganise the waypoints, so that next becomes current and so on
SG_LOG(SG_GENERAL, SG_DEBUG, "AIShip: " << _name << " getting new waypoints ");
SG_LOG(SG_AI, SG_DEBUG, "AIShip: " << _name << " getting new waypoints ");
fp->IncrementWaypoint(false);
prev = fp->getPreviousWaypoint(); //first waypoint
curr = fp->getCurrentWaypoint(); //second waypoint
@ -820,14 +820,14 @@ void FGAIShip::ProcessFlightPlan(double dt) {
if (finite(_course))
TurnTo(_course);
else
SG_LOG(SG_GENERAL, SG_ALERT, "AIShip: Bearing or Range is not a finite number");
SG_LOG(SG_AI, SG_ALERT, "AIShip: Bearing or Range is not a finite number");
_dt_count = 0;
} // end Processing FlightPlan
bool FGAIShip::initFlightPlan() {
SG_LOG(SG_GENERAL, SG_ALERT, "AIShip: " << _name << " initializing waypoints ");
SG_LOG(SG_AI, SG_ALERT, "AIShip: " << _name << " initializing waypoints ");
bool init = false;
_start_sec = 0;
@ -841,7 +841,7 @@ bool FGAIShip::initFlightPlan() {
next = fp->getNextWaypoint(); //third waypoint (might not exist!)
while (curr->getName() == "WAIT" || curr->getName() == "WAITUNTIL") { // don't wait when initialising
SG_LOG(SG_GENERAL, SG_DEBUG, "AIShip: " << _name << " re-initializing waypoints ");
SG_LOG(SG_AI, SG_DEBUG, "AIShip: " << _name << " re-initializing waypoints ");
fp->IncrementWaypoint(false);
curr = fp->getCurrentWaypoint();
next = fp->getNextWaypoint();
@ -889,7 +889,7 @@ bool FGAIShip::initFlightPlan() {
_missed_count = 0;
_new_waypoint = true;
SG_LOG(SG_GENERAL, SG_ALERT, "AIShip: " << _name << " done initialising waypoints " << _tunnel);
SG_LOG(SG_AI, SG_ALERT, "AIShip: " << _name << " done initialising waypoints " << _tunnel);
if (prev)
init = true;

View file

@ -414,7 +414,7 @@ void FGAIWingman::Join(double dt) {
_formate_to_ac = true;
_join = false;
SG_LOG(SG_GENERAL, SG_ALERT, _name << " joined " << " RANGE " << distance
SG_LOG(SG_AI, SG_ALERT, _name << " joined " << " RANGE " << distance
<< " SPEED " << speed );
return;

View file

@ -439,7 +439,7 @@ FGMultiplayMgr::init (void)
rxPort = txPort;
}
if (rxPort <= 0) {
SG_LOG(SG_NETWORK, SG_ALERT,
SG_LOG(SG_NETWORK, SG_INFO,
"FGMultiplayMgr - No receiver port. Multiplayer mode disabled.");
return;
}
@ -454,7 +454,7 @@ FGMultiplayMgr::init (void)
mSocket.reset(new simgear::Socket());
if (!mSocket->open(false)) {
SG_LOG( SG_NETWORK, SG_WARN,
"FGMultiplayMgr - Failed to create data socket." );
"FGMultiplayMgr - Failed to create data socket. Multiplayer mode disabled." );
return;
}
mSocket->setBlocking(false);
@ -471,6 +471,8 @@ FGMultiplayMgr::init (void)
fgSetBool("/sim/multiplay/online", true);
mInitialised = true;
SG_LOG(SG_NETWORK, SG_ALERT, "Multiplayer mode active!");
} // FGMultiplayMgr::init()
//////////////////////////////////////////////////////////////////////