From 2c2b68fc4740d2e0aaa99a87f744a1cb48ee4b33 Mon Sep 17 00:00:00 2001 From: curt Date: Sat, 7 Nov 1998 19:07:06 +0000 Subject: [PATCH] Enable release builds using the --without-logging option to the configure script. Also a couple log message cleanups, plus some C to C++ comment conversion. --- Airports/genapt.cxx | 23 ++++++++++++++++------- Astro/stars.cxx | 10 ++++++++-- Main/GLUTmain.cxx | 11 +++++++++-- Main/fg_init.cxx | 8 +++++++- Objects/material.cxx | 8 +++++++- Time/event.cxx | 32 ++++++++++++++++++++------------ Time/sunpos.cxx | 18 +++++++++++++----- 7 files changed, 80 insertions(+), 30 deletions(-) diff --git a/Airports/genapt.cxx b/Airports/genapt.cxx index b65c5fa7a..4ef94cf70 100644 --- a/Airports/genapt.cxx +++ b/Airports/genapt.cxx @@ -90,7 +90,8 @@ gen_base( const Point3D& average, const container& perimeter, fgTILE *t) max_dist = 0.0; - cout << "generating airport base for size = " << perimeter.size() << "\n"; + FG_LOG( FG_TERRAIN, FG_INFO, + "generating airport base for size = " << perimeter.size() ); fragment.init(); fragment.tile_ptr = t; @@ -102,10 +103,12 @@ gen_base( const Point3D& average, const container& perimeter, fgTILE *t) << " in fgAptGenerat()" ); } - printf(" tile center = %.2f %.2f %.2f\n", - t->center.x(), t->center.y(), t->center.z() ); - printf(" airport center = %.2f %.2f %.2f\n", - average.x(), average.y(), average.z()); + FG_LOG( FG_TERRAIN, FG_INFO, + " tile center = " + << t->center.x() << " " << t->center.y() << " " << t->center.z() ); + FG_LOG( FG_TERRAIN, FG_INFO, + " airport center = " + << average.x() << " " << average.y() << " " << average.z() ); fragment.center = average; normal[0] = average.x(); @@ -233,7 +236,7 @@ fgAptGenerate(const string& path, fgTILE *tile) gen_base(average, perimeter, tile); } - cout << "Reading airport record\n"; + FG_LOG( FG_TERRAIN, FG_INFO, "Reading airport record" ); in >> apt_id; apt_name = ""; i = 1; @@ -243,7 +246,8 @@ fgAptGenerate(const string& path, fgTILE *tile) while ( in.get(c) && c != '\n' ) { apt_name += c; } - cout << "\tID = " + apt_id + " Name = " + apt_name + "\n"; + FG_LOG( FG_TERRAIN, FG_INFO, + "\tID = " << apt_id << " Name = " << apt_name ); } else if ( token == "p" ) { // airport area bounding polygon coordinate. These // specify a convex hull that should already have been cut @@ -281,6 +285,11 @@ fgAptGenerate(const string& path, fgTILE *tile) // $Log$ +// Revision 1.10 1998/11/07 19:07:06 curt +// Enable release builds using the --without-logging option to the configure +// script. Also a couple log message cleanups, plus some C to C++ comment +// conversion. +// // Revision 1.9 1998/11/06 21:17:32 curt // Converted to new logstream debugging facility. This allows release // builds with no messages at all (and no performance impact) by using diff --git a/Astro/stars.cxx b/Astro/stars.cxx index fa7957d33..ac20f6120 100644 --- a/Astro/stars.cxx +++ b/Astro/stars.cxx @@ -104,8 +104,9 @@ int fgStarsInit( void ) { } timer.stop(); - cerr << "Loaded " << starcount << " stars in " - << timer.elapsedSeconds() << " seconds" << endl; + FG_LOG( FG_ASTRO, FG_INFO, + "Loaded " << starcount << " stars in " + << timer.elapsedSeconds() << " seconds" ); min_magnitude[0] = 4.2; min_magnitude[1] = 3.6; @@ -254,6 +255,11 @@ void fgStarsRender( void ) { // $Log$ +// Revision 1.22 1998/11/07 19:07:07 curt +// Enable release builds using the --without-logging option to the configure +// script. Also a couple log message cleanups, plus some C to C++ comment +// conversion. +// // Revision 1.21 1998/11/06 21:17:42 curt // Converted to new logstream debugging facility. This allows release // builds with no messages at all (and no performance impact) by using diff --git a/Main/GLUTmain.cxx b/Main/GLUTmain.cxx index 96e687323..b913e7557 100644 --- a/Main/GLUTmain.cxx +++ b/Main/GLUTmain.cxx @@ -693,8 +693,10 @@ static void fgIdleFunction ( void ) { string slfile = current_options.get_fg_root() + "/Sounds/wasp.wav"; s1 = new slSample ( (char *)slfile.c_str() ); - printf("Rate = %d Bps = %d Stereo = %d\n", - s1 -> getRate(), s1 -> getBps(), s1 -> getStereo()); + FG_LOG( FG_GENERAL, FG_INFO, + "Rate = " << s1 -> getRate() + << " Bps = " << s1 -> getBps() + << " Stereo = " << s1 -> getStereo() ); audio_sched -> loopSample ( s1 ); if ( audio_sched->working() ) { @@ -897,6 +899,11 @@ int main( int argc, char **argv ) { // $Log$ +// Revision 1.64 1998/11/07 19:07:09 curt +// Enable release builds using the --without-logging option to the configure +// script. Also a couple log message cleanups, plus some C to C++ comment +// conversion. +// // Revision 1.63 1998/11/06 21:18:08 curt // Converted to new logstream debugging facility. This allows release // builds with no messages at all (and no performance impact) by using diff --git a/Main/fg_init.cxx b/Main/fg_init.cxx index 1e3e6dddb..7d4f2f205 100644 --- a/Main/fg_init.cxx +++ b/Main/fg_init.cxx @@ -105,7 +105,8 @@ int fgInitPosition( void ) { FG_Longitude = current_options.get_lon() * DEG_TO_RAD; FG_Latitude = current_options.get_lat() * DEG_TO_RAD; } - printf("starting altitude is = %.2f\n", current_options.get_altitude()); + FG_LOG( FG_GENERAL, FG_INFO, + "starting altitude is = " << current_options.get_altitude() ); FG_Altitude = current_options.get_altitude() * METER_TO_FEET; FG_Runway_altitude = FG_Altitude - 3.758099; @@ -376,6 +377,11 @@ int fgInitSubsystems( void ) // $Log$ +// Revision 1.48 1998/11/07 19:07:10 curt +// Enable release builds using the --without-logging option to the configure +// script. Also a couple log message cleanups, plus some C to C++ comment +// conversion. +// // Revision 1.47 1998/11/06 21:18:10 curt // Converted to new logstream debugging facility. This allows release // builds with no messages at all (and no performance impact) by using diff --git a/Objects/material.cxx b/Objects/material.cxx index a2dc6543e..01ade9ff6 100644 --- a/Objects/material.cxx +++ b/Objects/material.cxx @@ -293,7 +293,8 @@ fgMATERIAL_MGR::load_lib ( void ) in >> material_name >> token; if ( token == '{' ) { - printf( " Loading material %s\n", material_name.c_str() ); + FG_LOG( FG_TERRAIN, FG_INFO, + " Loading material " << material_name ); fgMATERIAL m; in >> m; @@ -355,6 +356,11 @@ fgMATERIAL_MGR::render_fragments() // $Log$ +// Revision 1.11 1998/11/07 19:07:12 curt +// Enable release builds using the --without-logging option to the configure +// script. Also a couple log message cleanups, plus some C to C++ comment +// conversion. +// // Revision 1.10 1998/11/06 21:18:17 curt // Converted to new logstream debugging facility. This allows release // builds with no messages at all (and no performance impact) by using diff --git a/Time/event.cxx b/Time/event.cxx index 24e7c490e..e499d56f1 100644 --- a/Time/event.cxx +++ b/Time/event.cxx @@ -94,7 +94,7 @@ fgEVENT::~fgEVENT() void fgEVENT::run() { - printf("Running %s\n", description.c_str() ); + FG_LOG(FG_TIME, FG_INFO, "Running " << description ); // record starting time timestamp( &last_run ); @@ -131,11 +131,14 @@ fgEVENT::run() int fgEVENT::PrintStats() const { - printf(" %-30s int=%.2fs cum=%ld min=%ld max=%ld count=%ld ave=%.2f\n", - description.c_str(), - interval / 1000.0, - cum_time, min_time, max_time, count, - cum_time / (double)count); + FG_LOG( FG_TIME, FG_INFO, + " " << description + << " int=" << interval / 1000.0 + << " cum=" << cum_time + << " min=" << min_time + << " max=" << max_time + << " count=" << count + << " ave=" << cum_time / (double)count ); return 0; } @@ -146,7 +149,7 @@ fgEVENT_MGR::fgEVENT_MGR( void ) { // Initialize the scheduling subsystem void fgEVENT_MGR::Init( void ) { - printf("Initializing event manager\n"); + FG_LOG(FG_TIME, FG_INFO, "Initializing event manager" ); run_queue.erase( run_queue.begin(), run_queue.end() ); event_table.erase( event_table.begin(), event_table.end() ); @@ -162,7 +165,7 @@ fgEVENT_MGR::Register( const string& desc, { fgEVENT e( desc, cb, status, interval ); - printf("Registering event: %s\n", desc.c_str() ); + FG_LOG( FG_TIME, FG_INFO, "Registering event: " << desc ); // Actually run the event e.run(); @@ -195,15 +198,15 @@ void fgEVENT_MGR::Resume( void ) { void fgEVENT_MGR::PrintStats() { - printf("\n"); - printf("Event Stats\n"); - printf("-----------\n"); + FG_LOG( FG_TIME, FG_INFO, "" ); + FG_LOG( FG_TIME, FG_INFO, "Event Stats" ); + FG_LOG( FG_TIME, FG_INFO, "-----------" ); for_each( event_table.begin(), event_table.end(), mem_fun_ref( &fgEVENT::PrintStats )); - printf("\n"); + FG_LOG( FG_TIME, FG_INFO, ""); } @@ -258,6 +261,11 @@ fgEVENT_MGR::~fgEVENT_MGR( void ) { // $Log$ +// Revision 1.10 1998/11/07 19:07:13 curt +// Enable release builds using the --without-logging option to the configure +// script. Also a couple log message cleanups, plus some C to C++ comment +// conversion. +// // Revision 1.9 1998/11/06 21:18:24 curt // Converted to new logstream debugging facility. This allows release // builds with no messages at all (and no performance impact) by using diff --git a/Time/sunpos.cxx b/Time/sunpos.cxx index 37c47aab7..5651fa9e2 100644 --- a/Time/sunpos.cxx +++ b/Time/sunpos.cxx @@ -45,6 +45,7 @@ //#include #include +#include #include #include
#include @@ -193,7 +194,8 @@ static double julian_date(int y, int m, int d) { /* lazy test to ensure gregorian calendar */ if (y < 1583) { - printf("WHOOPS! Julian dates only valid for 1582 oct 15 or later\n"); + FG_LOG( FG_TIME, FG_ALERT, + "WHOOPS! Julian dates only valid for 1582 oct 15 or later" ); } if ((m == 1) || (m == 2)) { @@ -338,7 +340,7 @@ void fgUpdateSunPos( void ) { t = &cur_time_params; v = ¤t_view; - printf(" Updating Sun position\n"); + FG_LOG( FG_TIME, FG_INFO, " Updating Sun position" ); // (not sure why there was two) // fgSunPosition(t->cur_time, &l->sun_lon, &sun_gd_lat); @@ -349,9 +351,10 @@ void fgUpdateSunPos( void ) { p = Point3D( l->sun_lon, l->sun_gc_lat, sl_radius ); l->fg_sunpos = fgPolarToCart3d(p); - printf( " t->cur_time = %ld\n", t->cur_time); - printf( " Sun Geodetic lat = %.5f Geocentric lat = %.5f\n", - sun_gd_lat, l->sun_gc_lat); + FG_LOG( FG_TIME, FG_INFO, " t->cur_time = " << t->cur_time ); + FG_LOG( FG_TIME, FG_INFO, + " Sun Geodetic lat = " << sun_gd_lat + << " Geocentric lat = " << l->sun_gc_lat ); // I think this will work better for generating the sun light vector l->sun_vec[0] = l->fg_sunpos.x(); @@ -423,6 +426,11 @@ void fgUpdateSunPos( void ) { // $Log$ +// Revision 1.16 1998/11/07 19:07:14 curt +// Enable release builds using the --without-logging option to the configure +// script. Also a couple log message cleanups, plus some C to C++ comment +// conversion. +// // Revision 1.15 1998/10/18 01:17:24 curt // Point3D tweaks. // -- 2.39.5