From: ehofman Date: Thu, 20 Mar 2003 10:43:02 +0000 (+0000) Subject: Change cout and cerr in SG_LOG() where appropriate, otherwise comment it out X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=df2ce45ab71442cd24d6bb9f8da3a0c2e13a8c7c;p=flightgear.git Change cout and cerr in SG_LOG() where appropriate, otherwise comment it out --- diff --git a/src/Airports/runways.cxx b/src/Airports/runways.cxx index 07f1cf224..ff45f4c7e 100644 --- a/src/Airports/runways.cxx +++ b/src/Airports/runways.cxx @@ -100,9 +100,9 @@ static string GetReverseRunwayNo(string rwyno) { string tmp = rwyno.substr(1, 1); if (( tmp == "L" || tmp == "R" || tmp == "C" ) || (rwyno.size() == 1)) { tmp = rwyno; - cout << "Standardising rwy number from " << tmp; rwyno = "0" + tmp; - cout << " to " << rwyno << '\n'; + SG_LOG( SG_GENERAL, SG_INFO, "Standardising rwy number from " << tmp + << " to " << rwyno ); } char buf[4]; @@ -196,9 +196,9 @@ bool FGRunways::search( const string& aptid, const string& rwyno, FGRunway* r ) string tmp = runwayno.substr(1, 1); if (( tmp == "L" || tmp == "R" || tmp == "C" ) || (runwayno.size() == 1)) { tmp = runwayno; - cout << "Standardising rwy number from " << tmp; runwayno = "0" + tmp; - cout << " to " << runwayno << '\n'; + SG_LOG(SG_GENERAL, SG_INFO, "Standardising rwy number from " << tmp + << " to " << runwayno ); } c4_RowRef row = vRunway->GetAt(index); diff --git a/src/Airports/simple.cxx b/src/Airports/simple.cxx index ba19df66a..560b0d466 100644 --- a/src/Airports/simple.cxx +++ b/src/Airports/simple.cxx @@ -91,7 +91,7 @@ FGAirports::search( const string& id, FGAirport* a ) const c4_FloatProp pElev ("Elevation"); int idx = vAirport->Find(pID[id.c_str()]); - cout << "idx = " << idx << endl; + SG_LOG( SG_TERRAIN, SG_INFO, "idx = " << idx ); if ( idx == -1 ) { return false; @@ -214,7 +214,7 @@ bool FGAirportsUtil::dump_mk4( const string& file ) { const_iterator end = airports.end(); while ( current != end ) { // add each airport record - cout << "out -> " << current->id << endl; + SG_LOG( SG_TERRAIN, SG_BULK, "out -> " << current->id ); pID (row) = current->id.c_str(); pLon (row) = current->longitude; pLat (row) = current->latitude; diff --git a/src/Cockpit/kr_87.cxx b/src/Cockpit/kr_87.cxx index 9c06f9a49..a516443ca 100644 --- a/src/Cockpit/kr_87.cxx +++ b/src/Cockpit/kr_87.cxx @@ -284,7 +284,7 @@ void FGKR_87::update( double dt ) { if ( set_rst_btn == 1 && set_rst_btn == last_set_rst_btn ) { // button depressed and was last iteration too tmp_timer += dt; - cout << "tmp_timer = " << tmp_timer << endl; + // cout << "tmp_timer = " << tmp_timer << endl; if ( tmp_timer > 2.0 ) { // button held depressed for 2 seconds cout << "entering elapsed count down mode" << endl; diff --git a/src/Cockpit/navcom.cxx b/src/Cockpit/navcom.cxx index 2f11e188d..6391c5d12 100644 --- a/src/Cockpit/navcom.cxx +++ b/src/Cockpit/navcom.cxx @@ -547,7 +547,7 @@ void FGNavCom::search() if ( globals->get_soundmgr()->add( sound, nav_fx_name ) ) { // cout << "Added nav-vor-ident sound" << endl; } else { - cout << "Failed to add v1-vor-ident sound" << endl; + SG_LOG(SG_COCKPIT, SG_WARN, "Failed to add v1-vor-ident sound"); } if ( globals->get_soundmgr()->exists( dme_fx_name ) ) { @@ -576,7 +576,7 @@ void FGNavCom::search() nav_trans_ident = ""; last_nav_id = ""; if ( ! globals->get_soundmgr()->remove( nav_fx_name ) ) { - cout << "Failed to remove nav-vor-ident sound" << endl; + SG_LOG(SG_COCKPIT, SG_WARN, "Failed to remove nav-vor-ident sound"); } globals->get_soundmgr()->remove( dme_fx_name ); // cout << "not picking up vor1. :-(" << endl; diff --git a/src/FDM/IO360.cxx b/src/FDM/IO360.cxx index 9c256b29a..2c2d0db23 100644 --- a/src/FDM/IO360.cxx +++ b/src/FDM/IO360.cxx @@ -26,8 +26,6 @@ #include STL_FSTREAM #include STL_IOSTREAM -SG_USING_STD(cout); - #include "IO360.hxx" #include "LaRCsim/ls_constants.h" @@ -131,10 +129,10 @@ void FGNewEngine::update() { // cout << "n = " << RPM << " rpm\n"; // cout << "T_amb = " << T_amb << '\n'; // cout << "running = " << running << '\n'; - cout << "fuel = " << fgGetFloat("/consumables/fuel/tank[0]/level-gal_us") << '\n'; +// cout << "fuel = " << fgGetFloat("/consumables/fuel/tank[0]/level-gal_us") << '\n'; // cout << "Percentage_Power = " << Percentage_Power << '\n'; // cout << "current_oil_temp = " << current_oil_temp << '\n'; - cout << "EGT = " << EGT << '\n'; +// cout << "EGT = " << EGT << '\n'; } count1++; if(count1 == 100) @@ -340,7 +338,7 @@ float FGNewEngine::Lookup_Combustion_Efficiency(float thi_actual) } //if we get here something has gone badly wrong - cout << "ERROR: error in FGNewEngine::Lookup_Combustion_Efficiency\n"; + SG_LOG(SG_AIRCRAFT, SG_ALERT, "error in FGNewEngine::Lookup_Combustion_Efficiency"); return neta_comb_actual; } @@ -394,7 +392,7 @@ float FGNewEngine::Power_Mixture_Correlation(float thi_actual) } //if we get here something has gone badly wrong - cout << "ERROR: error in FGNewEngine::Power_Mixture_Correlation\n"; + SG_LOG(SG_AIRCRAFT, SG_ALERT, "error in FGNewEngine::Power_Mixture_Correlation"); return mixPerPow_actual; } diff --git a/src/GUI/gui_funcs.cxx b/src/GUI/gui_funcs.cxx index 0e54ff1cb..e802c1d62 100644 --- a/src/GUI/gui_funcs.cxx +++ b/src/GUI/gui_funcs.cxx @@ -313,7 +313,7 @@ void SaveDialogOk(puObject*) { SaveDialogInput->getValue(&s); ofstream output(s); - cout << saveFile << endl; + // cout << saveFile << endl; if (output.good() && fgSaveFlight(output)) { output.close(); mkDialog("Saved flight"); diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx index 15fcf922e..9c77d4569 100644 --- a/src/Main/fg_init.cxx +++ b/src/Main/fg_init.cxx @@ -458,8 +458,8 @@ bool fgDetectLanguage() { SGPropertyNode *locale = fgInitLocale(language); if (!locale) { - cerr << "No internationalization settings specified in preferences.xml" - << endl; + SG_LOG(SG_GENERAL, SG_ALERT, + "No internationalization settings specified in preferences.xml" ); return false; } @@ -1212,11 +1212,11 @@ void fgInitFDM() { static void printMat(const sgVec4 *mat, char *name="") { int i; - cout << name << endl; + SG_LOG(SG_GENERAL, SG_BULK, name ); for(i=0; i<4; i++) { - cout <<" "<set_Velocities_Local_Airmass(getWindNorth(), speed, getWindDown()); @@ -578,7 +578,7 @@ setFDMDataLogging (bool state) void fgInitProps () { - cout << "start of fgInitProps()" << endl; + SG_LOG(SG_GENERAL, SG_DEBUG, "start of fgInitProps()" ); // Simulation fgTie("/sim/logging/priority", getLoggingPriority, setLoggingPriority); fgTie("/sim/logging/classes", getLoggingClasses, setLoggingClasses); @@ -617,7 +617,7 @@ fgInitProps () fgTie("/sim/temp/full-screen", getFullScreen, setFullScreen); fgTie("/sim/temp/fdm-data-logging", getFDMDataLogging, setFDMDataLogging); - cout << "end of fgInitProps()" << endl; + SG_LOG(SG_GENERAL, SG_DEBUG, "end of fgInitProps()" ); } diff --git a/src/Main/main.cxx b/src/Main/main.cxx index 11c5c5a16..bb12dcf6d 100644 --- a/src/Main/main.cxx +++ b/src/Main/main.cxx @@ -576,19 +576,21 @@ void fgRenderFrame() { // update the sky dome if ( fgGetBool("/sim/rendering/skyblend") ) { - /* cout << "thesky->repaint() sky_color = " + /* + SG_LOG( SG_GENERAL, SG_BULK, "thesky->repaint() sky_color = " << cur_light_params.sky_color[0] << " " << cur_light_params.sky_color[1] << " " << cur_light_params.sky_color[2] << " " - << cur_light_params.sky_color[3] << endl; - cout << " fog = " + << cur_light_params.sky_color[3] ); + SG_LOG( SG_GENERAL, SG_BULK, " fog = " << cur_light_params.fog_color[0] << " " << cur_light_params.fog_color[1] << " " << cur_light_params.fog_color[2] << " " - << cur_light_params.fog_color[3] << endl; - cout << " sun_angle = " << cur_light_params.sun_angle - << " moon_angle = " << cur_light_params.moon_angle - << endl; */ + << cur_light_params.fog_color[3] ); + SG_LOG( SG_GENERAL, SG_BULK, + " sun_angle = " << cur_light_params.sun_angle + << " moon_angle = " << cur_light_params.moon_angle ); + */ thesky->repaint( cur_light_params.sky_color, cur_light_params.adj_fog_color, cur_light_params.sun_angle, @@ -598,18 +600,24 @@ void fgRenderFrame() { globals->get_ephem()->getNumStars(), globals->get_ephem()->getStars() ); - /* cout << "thesky->reposition( view_pos = " << view_pos[0] << " " - << view_pos[1] << " " << view_pos[2] << endl; - cout << " zero_elev = " << zero_elev[0] << " " + /* + SG_LOG( SG_GENERAL, SG_BULK, + "thesky->reposition( view_pos = " << view_pos[0] << " " + << view_pos[1] << " " << view_pos[2] ); + SG_LOG( SG_GENERAL, SG_BULK, + " zero_elev = " << zero_elev[0] << " " << zero_elev[1] << " " << zero_elev[2] << " lon = " << cur_fdm_state->get_Longitude() - << " lat = " << cur_fdm_state->get_Latitude() << endl; - cout << " sun_rot = " << cur_light_params.sun_rotation - << " gst = " << SGTime::cur_time_params->getGst() << endl; - cout << " sun ra = " << globals->get_ephem()->getSunRightAscension() - << " sun dec = " << globals->get_ephem()->getSunDeclination() - << " moon ra = " << globals->get_ephem()->getMoonRightAscension() - << " moon dec = " << globals->get_ephem()->getMoonDeclination() << endl; */ + << " lat = " << cur_fdm_state->get_Latitude() ); + SG_LOG( SG_GENERAL, SG_BULK, + " sun_rot = " << cur_light_params.sun_rotation + << " gst = " << SGTime::cur_time_params->getGst() ); + SG_LOG( SG_GENERAL, SG_BULK, + " sun ra = " << globals->get_ephem()->getSunRightAscension() + << " sun dec = " << globals->get_ephem()->getSunDeclination() + << " moon ra = " << globals->get_ephem()->getMoonRightAscension() + << " moon dec = " << globals->get_ephem()->getMoonDeclination() ); + */ thesky->reposition( current__view->get_view_pos(), current__view->get_zero_elev(), diff --git a/src/Main/options.cxx b/src/Main/options.cxx index 379aef919..e38d670fc 100644 --- a/src/Main/options.cxx +++ b/src/Main/options.cxx @@ -338,7 +338,7 @@ parse_time(const string& time_in) { result += seconds / 3600.0; } - cout << " parse_time() = " << sign * result << endl; + SG_LOG( SG_GENERAL, SG_INFO, " parse_time() = " << sign * result ); return(sign * result); } @@ -526,11 +526,11 @@ parse_fov( const string& arg ) { static bool add_channel( const string& type, const string& channel_str ) { - cout << "Channel string = " << channel_str << endl; + SG_LOG(SG_GENERAL, SG_INFO, "Channel string = " << channel_str ); globals->get_channel_options_list()->push_back( type + "," + channel_str ); - cout << "here" << endl; + // cout << "here" << endl; return true; } @@ -1808,7 +1808,7 @@ fgUsage (bool verbose) SGPropertyNode options_root; - cout << "" << endl; + cout << endl; try { fgLoadProps("options.xml", &options_root); diff --git a/src/MultiPlayer/multiplayrxmgr.cxx b/src/MultiPlayer/multiplayrxmgr.cxx index 28d38e293..61ca69514 100644 --- a/src/MultiPlayer/multiplayrxmgr.cxx +++ b/src/MultiPlayer/multiplayrxmgr.cxx @@ -56,6 +56,8 @@ #include #include #include + +#include #include
#include "multiplayrxmgr.hxx" @@ -119,9 +121,13 @@ bool FGMultiplayRxMgr::init(void) { m_sRxAddress = fgGetString("/sim/multiplay/rxhost"); m_iRxPort = fgGetInt("/sim/multiplay/rxport"); - cout << "FGMultiplayRxMgr::init - rxaddress= " << m_sRxAddress << endl; - cout << "FGMultiplayRxMgr::init - rxport= " << m_iRxPort << endl; - cout << "FGMultiplayRxMgr::init - callsign= " << m_sCallsign << endl; + SG_LOG( SG_NETWORK, SG_INFO, "FGMultiplayRxMgr::init - rxaddress= " + << m_sRxAddress ); + SG_LOG( SG_NETWORK, SG_INFO, "FGMultiplayRxMgr::init - rxport= " + << m_iRxPort); + SG_LOG( SG_NETWORK, SG_INFO, "FGMultiplayRxMgr::init - callsign= " + << m_sCallsign ); + // Create and open rx socket mDataRxSocket = new netSocket(); @@ -238,9 +244,9 @@ void FGMultiplayRxMgr::ProcessData(void) { case CHAT_MSG_ID: if (MsgHdr->iMsgLen == sizeof(T_MsgHdr) + sizeof(T_ChatMsg)) { ChatMsg = (T_ChatMsg *)(sMsg + sizeof(T_MsgHdr)); - cout << "Chat [" << MsgHdr->sCallsign << "]" << " " << ChatMsg->sText << endl; + SG_LOG( SG_NETWORK, SG_BULK, "Chat [" << MsgHdr->sCallsign << "]" << " " << ChatMsg->sText ); } else { - cerr << "FGMultiplayRxMgr::MP_ProcessData - Chat message received with insufficient data" << endl; + SG_LOG( SG_NETWORK, SG_ALERT, "FGMultiplayRxMgr::MP_ProcessData - Chat message received with insufficient data" ); } break; @@ -268,8 +274,7 @@ void FGMultiplayRxMgr::ProcessData(void) { iPlayerCnt = 0; do { if (m_Player[iPlayerCnt] == NULL) { - cout << "FGMultiplayRxMgr::ProcessRxData - Add new player. IP: " << sIpAddress - << ", Call: " << sCallsign << ", model: " << sModelName << endl; + SG_LOG( SG_NETWORK, SG_INFO, "FGMultiplayRxMgr::ProcessRxData - Add new player. IP: " << sIpAddress << ", Call: " << sCallsign << ", model: " << sModelName ); m_Player[iPlayerCnt] = new MPPlayer; m_Player[iPlayerCnt]->Open(string(sIpAddress), iPort, string(sCallsign), string(sModelName), false); m_Player[iPlayerCnt]->SetPosition(PosMsg->PlayerPos); diff --git a/src/MultiPlayer/multiplaytxmgr.cxx b/src/MultiPlayer/multiplaytxmgr.cxx index 59a8991ca..0b4336b78 100644 --- a/src/MultiPlayer/multiplaytxmgr.cxx +++ b/src/MultiPlayer/multiplaytxmgr.cxx @@ -36,7 +36,10 @@ #include #include #include + +#include #include
+ #include "multiplaytxmgr.hxx" #include "mpmessages.hxx" #include "mpplayer.hxx" @@ -92,8 +95,10 @@ bool FGMultiplayTxMgr::init(void) { string sTxAddress = fgGetString("/sim/multiplay/txhost"); iTxPort = fgGetInt("/sim/multiplay/txport"); - cout << "FGMultiplayTxMgr::init - txaddress= " << sTxAddress << endl; - cout << "FGMultiplayTxMgr::init - txport= " << iTxPort << endl; + SG_LOG( SG_NETWORK, SG_INFO, "FGMultiplayTxMgr::init - txaddress= " + << sTxAddress ); + SG_LOG( SG_NETWORK, SG_INFO, "FGMultiplayTxMgr::init - txport= " + << iTxPort ); if (iTxPort > 0) { @@ -126,7 +131,7 @@ bool FGMultiplayTxMgr::init(void) { // If Tx port == zero then don't initialise } else { - cout << "FGMultiplayTxMgr::init - Tx Port is zero. Multiplay out disabled." << endl; + SG_LOG( SG_NETWORK, SG_WARN, "FGMultiplayTxMgr::init - Tx Port is zero. Multiplay out disabled." ); bSuccess = false; } @@ -135,7 +140,7 @@ bool FGMultiplayTxMgr::init(void) { m_bInitialised = bSuccess; } else { - cerr << "FGMultiplayTxMgr::init - Attempt to init object that is already opened" << endl; + SG_LOG( SG_NETWORK, SG_ALERT, "FGMultiplayTxMgr::init - Attempt to init object that is already opened" ); bSuccess = false; } diff --git a/src/WeatherCM/linintp2.cpp b/src/WeatherCM/linintp2.cpp index d2ff5fe04..3c6e640fb 100644 --- a/src/WeatherCM/linintp2.cpp +++ b/src/WeatherCM/linintp2.cpp @@ -53,7 +53,7 @@ mgcLinInterp2D::mgcLinInterp2D (int _numPoints, double* x, double* y, return; } - cout << "[ 20%] allocating memory \r"; + SG_LOG(SG_MATH, SG_DEBUG, "[ 20%] allocating memory"); point = new double*[numPoints]; tmppoint = new double*[numPoints+3]; @@ -71,7 +71,7 @@ mgcLinInterp2D::mgcLinInterp2D (int _numPoints, double* x, double* y, f[i] = _f[i]; } - cout << "[ 30%] creating delaunay diagram \r"; + SG_LOG(SG_MATH, SG_DEBUG, "[ 30%] creating delaunay diagram"); Delaunay2D(); } @@ -290,7 +290,7 @@ int mgcLinInterp2D::Delaunay2D () nts = 1; // number of triangles i4 = 1; - cout << "[ 40%] create triangulation \r"; + SG_LOG(SG_MATH, SG_DEBUG, "[ 40%] create triangulation"); // compute triangulation for (i0 = 0; i0 < numPoints; i0++) @@ -383,7 +383,7 @@ Corner3:; } // count the number of triangles - cout << "[ 50%] count the number of triangles \r"; + SG_LOG(SG_MATH, SG_DEBUG, "[ 50%] count the number of triangles"); numTriangles = 0; i0 = -1; @@ -405,7 +405,7 @@ Corner3:; } // create the triangles - cout << "[ 60%] create the triangles \r"; + SG_LOG(SG_MATH, SG_DEBUG "[ 60%] create the triangles"); triangle = new Triangle[numTriangles]; @@ -439,7 +439,7 @@ Corner3:; } // build edge table - cout << "[ 70%] build the edge table \r"; + SG_LOG(SG_MATH, SG_DEBUG, "[ 70%] build the edge table"); numEdges = 0; edge = new Edge[3*numTriangles]; @@ -448,7 +448,7 @@ Corner3:; for (i = 0; i < numTriangles; i++) { if ( (i%500) == 0) - cout << "[ 7" << 10*i/numTriangles << "%] build the edge table \r"; + SG_LOG(SG_MATH, SG_BULK, "[ 7" << 10*i/numTriangles << "%] build the edge table"); Triangle& t = triangle[i]; @@ -481,7 +481,7 @@ Corner3:; } // establish links between adjacent triangles - cout << "[ 80%] establishing links between adjacent triangles \r"; + SG_LOG(SG_MATH, SG_DEBUG, "[ 80%] establishing links between adjacent triangles"); for (i = 0; i < numEdges; i++) { @@ -505,7 +505,7 @@ ExitDelaunay:; delete[] ccr[0]; delete[] ccr; - cout << "[ 90%] finsishes delauney triangulation \r"; + SG_LOG(SG_MATH, SG_DEBUG, "[ 90%] finsishes delauney triangulation"); return result; } diff --git a/src/WeatherCM/sphrintp.cpp b/src/WeatherCM/sphrintp.cpp index 2366c753b..980e699e3 100644 --- a/src/WeatherCM/sphrintp.cpp +++ b/src/WeatherCM/sphrintp.cpp @@ -51,8 +51,8 @@ SphereInterpolate::SphereInterpolate (int n, const double* x, // For complete spherical coverage, include the two antipodal points // (0,0,1,f(0,0,1)) and (0,0,-1,f(0,0,-1)) in the data set. - cout << "Initialising spherical interpolator.\n"; - cout << "[ 0%] Allocating memory \r"; + SG_LOG(SG_MATH, SG_DEBUG, "Initialising spherical interpolator."); + SG_LOG(SG_MATH, SG_DEBUG, "[ 0%] Allocating memory"); theta = new double[3*n]; phi = new double[3*n]; @@ -68,7 +68,7 @@ SphereInterpolate::SphereInterpolate (int n, const double* x, } // use periodicity to get wrap-around in the Delaunay triangulation - cout << "[ 10%] copying vertices for wrap-around\r"; + SG_LOG(SG_MATH, SG_DEBUG, "[ 10%] copying vertices for wrap-aroundr"); int j, k; for (i = 0, j = n, k = 2*n; i < n; i++, j++, k++) { @@ -82,7 +82,7 @@ SphereInterpolate::SphereInterpolate (int n, const double* x, pInterp = new mgcLinInterp2D(3*n,theta,phi,func); - cout << "[100%] Finished initialising spherical interpolator. \n"; + SG_LOG(SG_MATH, SG_DEBUG, "[100%] Finished initialising spherical interpolator."); } SphereInterpolate::SphereInterpolate (int n, const sgVec2* p, const unsigned int* f) @@ -90,15 +90,15 @@ SphereInterpolate::SphereInterpolate (int n, const sgVec2* p, const unsigned int // Assumes (x[i],y[i],z[i]) is unit length for all 0 <= i < n. // For complete spherical coverage, include the two antipodal points // (0,0,1,f(0,0,1)) and (0,0,-1,f(0,0,-1)) in the data set. - cout << "Initialising spherical interpolator.\n"; - cout << "[ 0%] Allocating memory \r"; + SG_LOG(SG_MATH, SG_DEBUG, "Initialising spherical interpolator."); + SG_LOG(SG_MATH, SG_DEBUG, "[ 0%] Allocating memory"); theta = new double[3*n]; phi = new double[3*n]; func = new unsigned int[3*n]; // convert data to spherical coordinates - cout << "[ 10%] copying vertices for wrap-around \r"; + SG_LOG(SG_MATH, SG_DEBUG, "[ 10%] copying vertices for wrap-around"); int i, j, k; for (i = 0, j = n, k = 2*n; i < n; i++, j++, k++) @@ -118,7 +118,7 @@ SphereInterpolate::SphereInterpolate (int n, const sgVec2* p, const unsigned int pInterp = new mgcLinInterp2D(3*n,theta,phi,func); - cout << "[100%] Finished initialising spherical interpolator. \n"; + SG_LOG(SG_MATH, SG_DEBUG, "[100%] Finished initialising spherical interpolator."); } //--------------------------------------------------------------------------- SphereInterpolate::~SphereInterpolate ()