From: curt Date: Sat, 24 Mar 2001 05:02:14 +0000 (+0000) Subject: SG-ified logstream. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=557fade4a7df3f030b943ba6114c3c566c57b73c;p=simgear.git SG-ified logstream. --- diff --git a/Doxyfile b/Doxyfile index 15c13bd2..387b86a0 100644 --- a/Doxyfile +++ b/Doxyfile @@ -300,7 +300,8 @@ WARN_LOGFILE = INPUT = \ simgear/bucket \ simgear/compiler.h \ - simgear/constants.h + simgear/constants.h \ + simgear/debug # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp diff --git a/simgear/compiler.h b/simgear/compiler.h index 7edc7a8f..0c0124e6 100644 --- a/simgear/compiler.h +++ b/simgear/compiler.h @@ -333,6 +333,9 @@ # define SG_USING_NAMESPACE(X) #endif +/** \def SG_USING_STD(x) + * Expands to using std::x if SG_HAVE_STD is defined + */ # ifdef SG_HAVE_STD # define SG_USING_STD(X) using std::X # define STD std diff --git a/simgear/debug/debug_types.h b/simgear/debug/debug_types.h index 4c310d21..9dfb88e2 100644 --- a/simgear/debug/debug_types.h +++ b/simgear/debug/debug_types.h @@ -1,38 +1,43 @@ -// NB: To add a dbg_class, add it here, and add it to the structure in -// fg_debug.c +/** \file debug_types.h + * Define the various logging classes and prioritiess + */ +/** + * Define the possible classes/categories of logging messages + */ typedef enum { - FG_NONE = 0x00000000, + SG_NONE = 0x00000000, - FG_TERRAIN = 0x00000001, - FG_ASTRO = 0x00000002, - FG_FLIGHT = 0x00000004, - FG_INPUT = 0x00000008, - FG_GL = 0x00000010, - FG_VIEW = 0x00000020, - FG_COCKPIT = 0x00000040, - FG_GENERAL = 0x00000080, - FG_MATH = 0x00000100, - FG_EVENT = 0x00000200, - FG_AIRCRAFT = 0x00000400, - FG_AUTOPILOT = 0x00000800, - FG_IO = 0x00001000, - FG_CLIPPER = 0x00002000, - FG_NETWORK = 0x00004000, - FG_UNDEFD = 0x00008000, // For range checking + SG_TERRAIN = 0x00000001, + SG_ASTRO = 0x00000002, + SG_FLIGHT = 0x00000004, + SG_INPUT = 0x00000008, + SG_GL = 0x00000010, + SG_VIEW = 0x00000020, + SG_COCKPIT = 0x00000040, + SG_GENERAL = 0x00000080, + SG_MATH = 0x00000100, + SG_EVENT = 0x00000200, + SG_AIRCRAFT = 0x00000400, + SG_AUTOPILOT = 0x00000800, + SG_IO = 0x00001000, + SG_CLIPPER = 0x00002000, + SG_NETWORK = 0x00004000, + SG_UNDEFD = 0x00008000, // For range checking - FG_ALL = 0xFFFFFFFF -} fgDebugClass; + SG_ALL = 0xFFFFFFFF +} sgDebugClass; -// NB: To add a priority, add it here. +/** + * Define the possible logging priorities (and their order). + */ typedef enum { - FG_BULK, // For frequent messages - FG_DEBUG, // Less frequent debug type messages - FG_INFO, // Informatory messages - FG_WARN, // Possible impending problem - FG_ALERT // Very possible impending problem - // FG_EXIT, // Problem (no core) - // FG_ABORT // Abandon ship (core) -} fgDebugPriority; - + SG_BULK, // For frequent messages + SG_DEBUG, // Less frequent debug type messages + SG_INFO, // Informatory messages + SG_WARN, // Possible impending problem + SG_ALERT // Very possible impending problem + // SG_EXIT, // Problem (no core) + // SG_ABORT // Abandon ship (core) +} sgDebugPriority; diff --git a/simgear/debug/logstream.cxx b/simgear/debug/logstream.cxx index e1201bfd..0a6e64f4 100644 --- a/simgear/debug/logstream.cxx +++ b/simgear/debug/logstream.cxx @@ -24,8 +24,8 @@ #include "logstream.hxx" bool logbuf::logging_enabled = true; -fgDebugClass logbuf::logClass = FG_NONE; -fgDebugPriority logbuf::logPriority = FG_INFO; +sgDebugClass logbuf::logClass = SG_NONE; +sgDebugPriority logbuf::logPriority = SG_INFO; streambuf* logbuf::sbuf = NULL; logbuf::logbuf() @@ -50,14 +50,14 @@ logbuf::set_sb( streambuf* sb ) } void -logbuf::set_log_level( fgDebugClass c, fgDebugPriority p ) +logbuf::set_log_level( sgDebugClass c, sgDebugPriority p ) { logClass = c; logPriority = p; } void -logstream::setLogLevels( fgDebugClass c, fgDebugPriority p ) +logstream::setLogLevels( sgDebugClass c, sgDebugPriority p ) { logbuf::set_log_level( c, p ); } diff --git a/simgear/debug/logstream.hxx b/simgear/debug/logstream.hxx index d622d117..c640461a 100644 --- a/simgear/debug/logstream.hxx +++ b/simgear/debug/logstream.hxx @@ -1,5 +1,7 @@ -// Stream based logging mechanism. -// +/** \file logstream.hxx + * Stream based logging mechanism. + */ + // Written by Bernie Bright, 1998 // // Copyright (C) 1998 Bernie Bright - bbright@c031.aone.net.au @@ -28,7 +30,6 @@ # include #endif - #include // At least Irix needs this @@ -67,12 +68,11 @@ SG_USING_STD(iostream); // 3. Read environment for default debugClass and debugPriority. // -//----------------------------------------------------------------------------- -// -// logbuf is an output-only streambuf with the ability to disable sets of -// messages at runtime. Only messages with priority >= logbuf::logPriority -// and debugClass == logbuf::logClass are output. -// +/** + * logbuf is an output-only streambuf with the ability to disable sets of + * messages at runtime. Only messages with priority >= logbuf::logPriority + * and debugClass == logbuf::logClass are output. + */ class logbuf : public streambuf { public: @@ -83,27 +83,32 @@ public: // typedef char_traits::pos_type pos_type; // typedef char_traits::off_type off_type; #endif -// logbuf( streambuf* sb ) : sbuf(sb) {} + // logbuf( streambuf* sb ) : sbuf(sb) {} + /** Constructor */ logbuf(); + /** Destructor */ ~logbuf(); - // Is logging enabled? + /** Is logging enabled? */ bool enabled() { return logging_enabled; } - // Set the logging level of subsequent messages. - void set_log_state( fgDebugClass c, fgDebugPriority p ); + /** Set the logging level of subsequent messages. */ + void set_log_state( sgDebugClass c, sgDebugPriority p ); - // Set the global logging level. - static void set_log_level( fgDebugClass c, fgDebugPriority p ); + /** Set the global logging level. */ + static void set_log_level( sgDebugClass c, sgDebugPriority p ); - // + /** Set the stream buffer */ void set_sb( streambuf* sb ); protected: + /** sync/flush */ inline virtual int sync(); + + /** overflow */ int_type overflow( int ch ); -// int xsputn( const char* s, istreamsize n ); + // int xsputn( const char* s, istreamsize n ); private: @@ -111,8 +116,8 @@ private: static streambuf* sbuf; static bool logging_enabled; - static fgDebugClass logClass; - static fgDebugPriority logPriority; + static sgDebugClass logClass; + static sgDebugPriority logPriority; private: @@ -132,7 +137,7 @@ logbuf::sync() } inline void -logbuf::set_log_state( fgDebugClass c, fgDebugPriority p ) +logbuf::set_log_state( sgDebugClass c, sgDebugPriority p ) { logging_enabled = ((c & logClass) != 0 && p >= logPriority); } @@ -143,54 +148,52 @@ logbuf::overflow( int c ) return logging_enabled ? sbuf->sputc(c) : (EOF == 0 ? 1: 0); } -//----------------------------------------------------------------------------- -// -// logstream manipulator for setting the log level of a message. -// +/** + * logstream manipulator for setting the log level of a message. + */ struct loglevel { - loglevel( fgDebugClass c, fgDebugPriority p ) + loglevel( sgDebugClass c, sgDebugPriority p ) : logClass(c), logPriority(p) {} - fgDebugClass logClass; - fgDebugPriority logPriority; + sgDebugClass logClass; + sgDebugPriority logPriority; }; -//----------------------------------------------------------------------------- -// -// A helper class that ensures a streambuf and ostream are constructed and -// destroyed in the correct order. The streambuf must be created before the -// ostream but bases are constructed before members. Thus, making this class -// a private base of logstream, declared to the left of ostream, we ensure the -// correct order of construction and destruction. -// +/** + * A helper class that ensures a streambuf and ostream are constructed and + * destroyed in the correct order. The streambuf must be created before the + * ostream but bases are constructed before members. Thus, making this class + * a private base of logstream, declared to the left of ostream, we ensure the + * correct order of construction and destruction. + */ struct logstream_base { -// logstream_base( streambuf* sb ) : lbuf(sb) {} + // logstream_base( streambuf* sb ) : lbuf(sb) {} logstream_base() {} logbuf lbuf; }; -//----------------------------------------------------------------------------- -// -// -// +/** + * Class to manage the debug logging stream. + */ class logstream : private logstream_base, public ostream { public: - // The default is to send messages to cerr. + /** The default is to send messages to cerr. */ logstream( ostream& out ) -// : logstream_base(out.rdbuf()), + // : logstream_base(out.rdbuf()), : logstream_base(), ostream(&lbuf) { lbuf.set_sb(out.rdbuf());} + /** Set the output stream */ void set_output( ostream& out ) { lbuf.set_sb( out.rdbuf() ); } - // Set the global log class and priority level. - void setLogLevels( fgDebugClass c, fgDebugPriority p ); + /** Set the global log class and priority level. */ + void setLogLevels( sgDebugClass c, sgDebugPriority p ); - // Output operator to capture the debug level and priority of a message. + /** Output operator to capture the debug level and priority of a message. */ inline ostream& operator<< ( const loglevel& l ); }; @@ -201,26 +204,31 @@ logstream::operator<< ( const loglevel& l ) return *this; } -//----------------------------------------------------------------------------- -// -// Return the one and only logstream instance. -// We use a function instead of a global object so we are assured that cerr -// has been initialised. -// + +/** + * Return the one and only logstream instance. + * We use a function instead of a global object so we are assured that cerr + * has been initialised. + */ inline logstream& -fglog() +sglog() { static logstream logstrm( cerr ); return logstrm; } + +/** \def SG_LOG(C,P,M) + * Log a message = M of class = C and priority = P + */ #ifdef FG_NDEBUG -# define FG_LOG(C,P,M) +# define SG_LOG(C,P,M) #elif defined( __MWERKS__ ) -# define FG_LOG(C,P,M) ::fglog() << ::loglevel(C,P) << M << std::endl +# define SG_LOG(C,P,M) ::sglog() << ::loglevel(C,P) << M << std::endl #else -# define FG_LOG(C,P,M) fglog() << loglevel(C,P) << M << endl +# define SG_LOG(C,P,M) sglog() << loglevel(C,P) << M << endl #endif + #endif // _LOGSTREAM_H diff --git a/simgear/debug/logtest.cxx b/simgear/debug/logtest.cxx index b02c6b08..bf923e7a 100644 --- a/simgear/debug/logtest.cxx +++ b/simgear/debug/logtest.cxx @@ -4,20 +4,20 @@ int main( int argc, char* argv[] ) { - fglog().setLogLevels( FG_ALL, FG_INFO ); + fglog().setLogLevels( SG_ALL, SG_INFO ); - FG_LOG( FG_TERRAIN, FG_BULK, "terrain::bulk" ); // shouldnt appear - FG_LOG( FG_TERRAIN, FG_DEBUG, "terrain::debug" ); // shouldnt appear - FG_LOG( FG_TERRAIN, FG_INFO, "terrain::info" ); - FG_LOG( FG_TERRAIN, FG_WARN, "terrain::warn" ); - FG_LOG( FG_TERRAIN, FG_ALERT, "terrain::alert" ); + SG_LOG( FG_TERRAIN, FG_BULK, "terrain::bulk" ); // shouldnt appear + SG_LOG( FG_TERRAIN, SG_DEBUG, "terrain::debug" ); // shouldnt appear + SG_LOG( FG_TERRAIN, SG_INFO, "terrain::info" ); + SG_LOG( FG_TERRAIN, FG_WARN, "terrain::warn" ); + SG_LOG( FG_TERRAIN, SG_ALERT, "terrain::alert" ); int i = 12345; long l = 54321L; double d = 3.14159; string s = "Hello world!"; - FG_LOG( FG_EVENT, FG_INFO, "event::info " + SG_LOG( SG_EVENT, SG_INFO, "event::info " << "i=" << i << ", l=" << l << ", d=" << d @@ -25,7 +25,7 @@ main( int argc, char* argv[] ) << ", s=\"" << s << "\"" ); // This shouldn't appear in log output: - FG_LOG( FG_EVENT, FG_DEBUG, "event::debug " + SG_LOG( SG_EVENT, SG_DEBUG, "event::debug " << "- this should be seen - " << "d=" << d << ", s=\"" << s << "\"" ); diff --git a/simgear/ephemeris/celestialBody.cxx b/simgear/ephemeris/celestialBody.cxx index f72b354c..ae6a7929 100644 --- a/simgear/ephemeris/celestialBody.cxx +++ b/simgear/ephemeris/celestialBody.cxx @@ -88,7 +88,7 @@ void CelestialBody::updatePosition(double mjd, Star *ourSun) ze = yg * sin(ecl) + zg * cos(ecl); rightAscension = atan2(ye, xe); declination = atan2(ze, sqrt(xe*xe + ye*ye)); - /* FG_LOG(FG_GENERAL, FG_INFO, "Planet found at : " + /* SG_LOG(SG_GENERAL, SG_INFO, "Planet found at : " << rightAscension << " (ra), " << declination << " (dec)" ); */ //calculate some variables specific to calculating the magnitude diff --git a/simgear/ephemeris/moonpos.cxx b/simgear/ephemeris/moonpos.cxx index ccc26418..d053082c 100644 --- a/simgear/ephemeris/moonpos.cxx +++ b/simgear/ephemeris/moonpos.cxx @@ -138,7 +138,7 @@ void MoonPos::updatePosition(double mjd, double lst, double lat, Star *ourSun) r += (-0.58 * cos(M - 2*D) -0.46 * cos(2*D) ); - // FG_LOG(FG_GENERAL, FG_INFO, "Running moon update"); + // SG_LOG(SG_GENERAL, SG_INFO, "Running moon update"); xg = r * cos(lonEcl) * cos(latEcl); yg = r * sin(lonEcl) * cos(latEcl); zg = r * sin(latEcl); @@ -150,7 +150,7 @@ void MoonPos::updatePosition(double mjd, double lst, double lat, Star *ourSun) geoRa = atan2(ye, xe); geoDec = atan2(ze, sqrt(xe*xe + ye*ye)); - /* FG_LOG( FG_GENERAL, FG_INFO, + /* SG_LOG( SG_GENERAL, SG_INFO, "(geocentric) geoRa = (" << (SGD_RADIANS_TO_DEGREES * geoRa) << "), geoDec= (" << (SGD_RADIANS_TO_DEGREES * geoDec) << ")" ); */ @@ -162,30 +162,30 @@ void MoonPos::updatePosition(double mjd, double lst, double lat, Star *ourSun) // First calculate the moon's parrallax, that is, the apparent size of the // (equatorial) radius of the earth, as seen from the moon mpar = asin ( 1 / r); - // FG_LOG( FG_GENERAL, FG_INFO, "r = " << r << " mpar = " << mpar ); - // FG_LOG( FG_GENERAL, FG_INFO, "lat = " << f->get_Latitude() ); + // SG_LOG( SG_GENERAL, SG_INFO, "r = " << r << " mpar = " << mpar ); + // SG_LOG( SG_GENERAL, SG_INFO, "lat = " << f->get_Latitude() ); gclat = lat - 0.003358 * sin (2 * SGD_DEGREES_TO_RADIANS * lat ); - // FG_LOG( FG_GENERAL, FG_INFO, "gclat = " << gclat ); + // SG_LOG( SG_GENERAL, SG_INFO, "gclat = " << gclat ); rho = 0.99883 + 0.00167 * cos(2 * SGD_DEGREES_TO_RADIANS * lat); - // FG_LOG( FG_GENERAL, FG_INFO, "rho = " << rho ); + // SG_LOG( SG_GENERAL, SG_INFO, "rho = " << rho ); if (geoRa < 0) geoRa += (2*SGD_PI); HA = lst - (3.8197186 * geoRa); - /* FG_LOG( FG_GENERAL, FG_INFO, "t->getLst() = " << t->getLst() + /* SG_LOG( SG_GENERAL, SG_INFO, "t->getLst() = " << t->getLst() << " HA = " << HA ); */ g = atan (tan(gclat) / cos ((HA / 3.8197186))); - // FG_LOG( FG_GENERAL, FG_INFO, "g = " << g ); + // SG_LOG( SG_GENERAL, SG_INFO, "g = " << g ); rightAscension = geoRa - mpar * rho * cos(gclat) * sin(HA) / cos (geoDec); declination = geoDec - mpar * rho * sin (gclat) * sin (g - geoDec) / sin(g); - /* FG_LOG( FG_GENERAL, FG_INFO, + /* SG_LOG( SG_GENERAL, SG_INFO, "Ra = (" << (SGD_RADIANS_TO_DEGREES *rightAscension) << "), Dec= (" << (SGD_RADIANS_TO_DEGREES *declination) << ")" ); */ } diff --git a/simgear/ephemeris/stardata.cxx b/simgear/ephemeris/stardata.cxx index 8f69356f..b5f5d63b 100644 --- a/simgear/ephemeris/stardata.cxx +++ b/simgear/ephemeris/stardata.cxx @@ -54,11 +54,11 @@ bool SGStarData::load() { // build the full path name to the stars data base file data_path.append( "stars" ); - FG_LOG( FG_ASTRO, FG_INFO, " Loading stars from " << data_path.str() ); + SG_LOG( SG_ASTRO, SG_INFO, " Loading stars from " << data_path.str() ); fg_gzifstream in( data_path.str() ); if ( ! in.is_open() ) { - FG_LOG( FG_ASTRO, FG_ALERT, "Cannot open star file: " + SG_LOG( SG_ASTRO, SG_ALERT, "Cannot open star file: " << data_path.str() ); exit(-1); } @@ -116,7 +116,7 @@ bool SGStarData::load() { ++nstars; } - FG_LOG( FG_ASTRO, FG_INFO, " Loaded " << nstars << " stars" ); + SG_LOG( SG_ASTRO, SG_INFO, " Loaded " << nstars << " stars" ); return true; } diff --git a/simgear/io/sg_file.cxx b/simgear/io/sg_file.cxx index ed740275..e8c7bb8e 100644 --- a/simgear/io/sg_file.cxx +++ b/simgear/io/sg_file.cxx @@ -60,13 +60,13 @@ bool SGFile::open( const SGProtocolDir d ) { } else if ( get_dir() == SG_IO_IN ) { fp = ::open( file_name.c_str(), O_RDONLY ); } else { - FG_LOG( FG_IO, FG_ALERT, + SG_LOG( SG_IO, SG_ALERT, "Error: bidirection mode not available for files." ); return false; } if ( fp == -1 ) { - FG_LOG( FG_IO, FG_ALERT, "Error opening file: " << file_name ); + SG_LOG( SG_IO, SG_ALERT, "Error opening file: " << file_name ); return false; } @@ -110,7 +110,7 @@ int SGFile::readline( char *buf, int length ) { int SGFile::write( const char *buf, const int length ) { int result = ::write( fp, buf, length ); if ( result != length ) { - FG_LOG( FG_IO, FG_ALERT, "Error writing data: " << file_name ); + SG_LOG( SG_IO, SG_ALERT, "Error writing data: " << file_name ); } return result; diff --git a/simgear/io/sg_serial.cxx b/simgear/io/sg_serial.cxx index 63d7a7ab..61457092 100644 --- a/simgear/io/sg_serial.cxx +++ b/simgear/io/sg_serial.cxx @@ -51,14 +51,14 @@ bool SGSerial::open( const SGProtocolDir d ) { set_dir( d ); if ( ! port.open_port( device ) ) { - FG_LOG( FG_IO, FG_ALERT, "Error opening device: " << device ); + SG_LOG( SG_IO, SG_ALERT, "Error opening device: " << device ); return false; } // cout << "fd = " << port.fd << endl; if ( ! port.set_baud( atoi( baud.c_str() ) ) ) { - FG_LOG( FG_IO, FG_ALERT, "Error setting baud: " << baud ); + SG_LOG( SG_IO, SG_ALERT, "Error setting baud: " << baud ); return false; } @@ -116,7 +116,7 @@ int SGSerial::readline( char *buf, int length ) { // copy to external buffer strncpy( buf, save_buf, result ); buf[result] = '\0'; - FG_LOG( FG_IO, FG_INFO, "fg_serial line = " << buf ); + SG_LOG( SG_IO, SG_INFO, "fg_serial line = " << buf ); // shift save buffer for ( i = result; i < save_len; ++i ) { @@ -133,7 +133,7 @@ int SGSerial::write( const char *buf, const int length ) { int result = port.write_port( buf, length ); if ( result != length ) { - FG_LOG( FG_IO, FG_ALERT, "Error writing data: " << device ); + SG_LOG( SG_IO, SG_ALERT, "Error writing data: " << device ); } return result; diff --git a/simgear/io/sg_socket.cxx b/simgear/io/sg_socket.cxx index c7f70200..144c64df 100644 --- a/simgear/io/sg_socket.cxx +++ b/simgear/io/sg_socket.cxx @@ -50,7 +50,7 @@ SGSocket::SGSocket( const string& host, const string& port, { #if defined(_MSC_VER) if (!wsock_init && !wsastartup()) { - FG_LOG( FG_IO, FG_ALERT, "Winsock not available"); + SG_LOG( SG_IO, SG_ALERT, "Winsock not available"); } #endif @@ -60,7 +60,7 @@ SGSocket::SGSocket( const string& host, const string& port, sock_style = SOCK_STREAM; } else { sock_style = SOCK_DGRAM; - FG_LOG( FG_IO, FG_ALERT, + SG_LOG( SG_IO, SG_ALERT, "Error: SGSocket() unknown style = " << style ); } @@ -84,7 +84,7 @@ SGSocket::SocketType SGSocket::make_server_socket () { // Create the socket. sock = socket (PF_INET, sock_style, 0); if (sock == INVALID_SOCKET) { - FG_LOG( FG_IO, FG_ALERT, + SG_LOG( SG_IO, SG_ALERT, "Error: socket() failed in make_server_socket()" ); return INVALID_SOCKET; } @@ -95,7 +95,7 @@ SGSocket::SocketType SGSocket::make_server_socket () { name.sin_port = htons(port); // set port to zero to let system pick name.sin_addr.s_addr = htonl (INADDR_ANY); if (bind (sock, (struct sockaddr *) &name, sizeof (name)) != 0) { - FG_LOG( FG_IO, FG_ALERT, + SG_LOG( SG_IO, SG_ALERT, "Error: bind() failed in make_server_socket()" ); return INVALID_SOCKET; } @@ -103,7 +103,7 @@ SGSocket::SocketType SGSocket::make_server_socket () { // Find the assigned port number length = sizeof(struct sockaddr_in); if ( getsockname(sock, (struct sockaddr *) &name, &length) ) { - FG_LOG( FG_IO, FG_ALERT, + SG_LOG( SG_IO, SG_ALERT, "Error: getsockname() failed in make_server_socket()" ); return INVALID_SOCKET; } @@ -117,12 +117,12 @@ SGSocket::SocketType SGSocket::make_client_socket () { struct sockaddr_in name; struct hostent *hp; - FG_LOG( FG_IO, FG_INFO, "Make client socket()" ); + SG_LOG( SG_IO, SG_INFO, "Make client socket()" ); // Create the socket. sock = socket (PF_INET, sock_style, 0); if (sock == INVALID_SOCKET) { - FG_LOG( FG_IO, FG_ALERT, + SG_LOG( SG_IO, SG_ALERT, "Error: socket() failed in make_server_socket()" ); return INVALID_SOCKET; } @@ -146,7 +146,7 @@ SGSocket::SocketType SGSocket::make_client_socket () { sizeof(struct sockaddr_in)) != 0 ) { closesocket(sock); - FG_LOG( FG_IO, FG_ALERT, + SG_LOG( SG_IO, SG_ALERT, "Error: connect() failed in make_client_socket()" ); return INVALID_SOCKET; } @@ -201,11 +201,11 @@ bool SGSocket::open( const SGProtocolDir d ) { // pick any available port. sock = make_server_socket(); if ( sock == INVALID_SOCKET ) { - FG_LOG( FG_IO, FG_ALERT, "socket creation failed" ); + SG_LOG( SG_IO, SG_ALERT, "socket creation failed" ); return false; } - FG_LOG( FG_IO, FG_INFO, "socket is connected to port = " << port ); + SG_LOG( SG_IO, SG_INFO, "socket is connected to port = " << port ); if ( sock_style == SOCK_DGRAM ) { // Non-blocking UDP @@ -235,19 +235,19 @@ bool SGSocket::open( const SGProtocolDir d ) { sock = make_server_socket(); // TODO: check for error. - FG_LOG( FG_IO, FG_INFO, "socket is connected to port = " << port ); + SG_LOG( SG_IO, SG_INFO, "socket is connected to port = " << port ); // Blocking TCP // Specify the maximum length of the connection queue listen( sock, SG_MAX_SOCKET_QUEUE ); } else { - FG_LOG( FG_IO, FG_ALERT, + SG_LOG( SG_IO, SG_ALERT, "Error: bidirection mode not available for UDP sockets." ); return false; } if ( sock < 0 ) { - FG_LOG( FG_IO, FG_ALERT, "Error opening socket: " << hostname + SG_LOG( SG_IO, SG_ALERT, "Error opening socket: " << hostname << ":" << port ); return false; } @@ -296,7 +296,7 @@ int SGSocket::read( char *buf, int length ) { } if ( result != length ) { - FG_LOG( FG_IO, FG_INFO, + SG_LOG( SG_IO, SG_INFO, "Warning: read() not enough bytes." ); } } @@ -355,7 +355,7 @@ int SGSocket::readline( char *buf, int length ) { // could cause problems so if you see connections // dropping for unexplained reasons, LOOK HERE! if ( result == 0 && save_len == 0 && first_read == true ) { - FG_LOG( FG_IO, FG_ALERT, + SG_LOG( SG_IO, SG_ALERT, "Connection closed by foreign host." ); closesocket(sock); open( get_dir() ); @@ -412,7 +412,7 @@ int SGSocket::write( const char *buf, const int length ) { bool error_condition = false; if ( writesocket(sock, buf, length) < 0 ) { - FG_LOG( FG_IO, FG_ALERT, "Error writing to socket: " << port ); + SG_LOG( SG_IO, SG_ALERT, "Error writing to socket: " << port ); error_condition = true; } @@ -433,7 +433,7 @@ int SGSocket::write( const char *buf, const int length ) { if ( FD_ISSET(sock, &ready) ) { int msgsock = accept(sock, 0, 0); if ( msgsock < 0 ) { - FG_LOG( FG_IO, FG_ALERT, + SG_LOG( SG_IO, SG_ALERT, "Error: accept() failed in write()" ); return 0; } else { @@ -441,7 +441,7 @@ int SGSocket::write( const char *buf, const int length ) { } } - FG_LOG( FG_IO, FG_INFO, "Client connections = " << + SG_LOG( SG_IO, SG_INFO, "Client connections = " << client_connections.size() ); for ( int i = 0; i < (int)client_connections.size(); ++i ) { int msgsock = client_connections[i]; @@ -452,7 +452,7 @@ int SGSocket::write( const char *buf, const int length ) { // write the interesting data to the socket if ( writesocket(msgsock, buf, length) == SOCKET_ERROR ) { - FG_LOG( FG_IO, FG_ALERT, "Error writing to socket: " << port ); + SG_LOG( SG_IO, SG_ALERT, "Error writing to socket: " << port ); error_condition = true; } else { #ifdef _POSIX_SYNCHRONIZED_IO @@ -504,7 +504,7 @@ bool SGSocket::nonblock() { u_long arg = 1; if (ioctlsocket( sock, FIONBIO, &arg ) != 0) { int error_code = WSAGetLastError(); - FG_LOG( FG_IO, FG_ALERT, + SG_LOG( SG_IO, SG_ALERT, "Error " << error_code << ": unable to set non-blocking mode" ); return false; @@ -529,14 +529,14 @@ SGSocket::wsastartup() { int err = WSAStartup( wVersionRequested, &wsaData ); if (err != 0) { - FG_LOG( FG_IO, FG_ALERT, "Error: Couldn't load winsock" ); + SG_LOG( SG_IO, SG_ALERT, "Error: Couldn't load winsock" ); return false; } #if 0 if ( LOBYTE( wsaData.wVersion ) != 2 || HIBYTE( wsaData.wVersion ) != 2 ) { - FG_LOG( FG_IO, FG_ALERT, "Couldn't load a suitable winsock"); + SG_LOG( SG_IO, SG_ALERT, "Couldn't load a suitable winsock"); WSACleanup( ); return false; } diff --git a/simgear/math/interpolater.cxx b/simgear/math/interpolater.cxx index e38ca2d1..064443ad 100644 --- a/simgear/math/interpolater.cxx +++ b/simgear/math/interpolater.cxx @@ -42,11 +42,11 @@ SG_USING_STD(string); // Constructor -- loads the interpolation table from the specified // file SGInterpTable::SGInterpTable( const string& file ) { - FG_LOG( FG_MATH, FG_INFO, "Initializing Interpolator for " << file ); + SG_LOG( SG_MATH, SG_INFO, "Initializing Interpolator for " << file ); fg_gzifstream in( file ); if ( !in.is_open() ) { - FG_LOG( FG_GENERAL, FG_ALERT, "Cannot open file: " << file ); + SG_LOG( SG_GENERAL, SG_ALERT, "Cannot open file: " << file ); exit(-1); } @@ -58,7 +58,7 @@ SGInterpTable::SGInterpTable( const string& file ) { in >> skipws; size++; } else { - FG_LOG( FG_MATH, FG_ALERT, + SG_LOG( SG_MATH, SG_ALERT, "fgInterpolateInit(): Exceed max table size = " << MAX_TABLE_SIZE ); exit(-1); @@ -83,14 +83,14 @@ double SGInterpTable::interpolate(double x) { // printf ("i = %d ", i); if ( (i == 0) && (x < table[0][0]) ) { - FG_LOG( FG_MATH, FG_DEBUG, + SG_LOG( SG_MATH, SG_DEBUG, "interpolate(): lookup error, x to small = " << x ); return table[0][1]; } // cout << " table[size-1][0] = " << table[size-1][0] << endl; if ( x > table[size-1][0] ) { - FG_LOG( FG_MATH, FG_DEBUG, + SG_LOG( SG_MATH, SG_DEBUG, "interpolate(): lookup error, x to big = " << x ); return table[size-1][1]; } diff --git a/simgear/math/sg_geodesy.cxx b/simgear/math/sg_geodesy.cxx index 9d30f092..4393778d 100644 --- a/simgear/math/sg_geodesy.cxx +++ b/simgear/math/sg_geodesy.cxx @@ -71,7 +71,7 @@ void sgGeocToGeod( double lat_geoc, double radius, double #ifdef DOMAIN_ERR_DEBUG if ( errno ) { perror("fgGeocToGeod()"); - FG_LOG( FG_GENERAL, FG_ALERT, "sqrt(" << t_lat*t_lat + E*E << ")" ); + SG_LOG( SG_GENERAL, SG_ALERT, "sqrt(" << t_lat*t_lat + E*E << ")" ); } #endif // cout << " x_alpha = " << x_alpha << endl; @@ -80,7 +80,7 @@ void sgGeocToGeod( double lat_geoc, double radius, double #ifdef DOMAIN_ERR_DEBUG if ( errno ) { perror("fgGeocToGeod()"); - FG_LOG( FG_GENERAL, FG_ALERT, "sqrt(" << SG_EQ_RAD_SQUARE_M - x_alpha * x_alpha + SG_LOG( SG_GENERAL, SG_ALERT, "sqrt(" << SG_EQ_RAD_SQUARE_M - x_alpha * x_alpha << ")" ); } #endif @@ -96,7 +96,7 @@ void sgGeocToGeod( double lat_geoc, double radius, double #ifdef DOMAIN_ERR_DEBUG if ( errno ) { perror("fgGeocToGeod()"); - FG_LOG( FG_GENERAL, FG_ALERT, "sqrt(" << + SG_LOG( SG_GENERAL, SG_ALERT, "sqrt(" << 1-EPS*EPS*sin_mu_a*sin_mu_a << ")" ); } #endif @@ -111,7 +111,7 @@ void sgGeocToGeod( double lat_geoc, double radius, double #ifdef DOMAIN_ERR_DEBUG if ( errno ) { perror("fgGeocToGeod()"); - FG_LOG( FG_GENERAL, FG_ALERT, "sqrt(" << + SG_LOG( SG_GENERAL, SG_ALERT, "sqrt(" << SG_EQ_RAD_SQUARE_M / (1 + ((1/(E*E))-1)*sin_lambda_sl*sin_lambda_sl) << ")" ); } @@ -153,7 +153,7 @@ void sgGeodToGeoc( double lat_geod, double alt, double *sl_radius, #ifdef DOMAIN_ERR_DEBUG if ( errno ) { perror("fgGeodToGeoc()"); - FG_LOG( FG_GENERAL, FG_ALERT, "sqrt(" << + SG_LOG( SG_GENERAL, SG_ALERT, "sqrt(" << SG_EQ_RAD_SQUARE_M / (1 + ((1/(E*E))-1)*sin_lambda_sl*sin_lambda_sl) << ")" ); } diff --git a/simgear/misc/props_io.cxx b/simgear/misc/props_io.cxx index 482af7a4..d4ea27de 100644 --- a/simgear/misc/props_io.cxx +++ b/simgear/misc/props_io.cxx @@ -113,7 +113,7 @@ PropsVisitor::startElement (const char * name, const XMLAttributes &atts) if (_level == 0) { if (string(name) != "PropertyList") { - FG_LOG(FG_INPUT, FG_ALERT, "Root element name is " << + SG_LOG(SG_INPUT, SG_ALERT, "Root element name is " << name << "; expected PropertyList"); _ok = false; } @@ -137,7 +137,7 @@ PropsVisitor::startElement (const char * name, const XMLAttributes &atts) const char * att_alias = atts.getValue("alias"); if (att_alias != 0) { if (!node->alias(att_alias)) - FG_LOG(FG_INPUT, FG_ALERT, "Failed to set alias to " << att_alias); + SG_LOG(SG_INPUT, SG_ALERT, "Failed to set alias to " << att_alias); } // Check for an include. @@ -148,7 +148,7 @@ PropsVisitor::startElement (const char * name, const XMLAttributes &atts) cerr << "Dir is " << FGPath(_base).dir() << endl; path.append(att_include); if (!readProperties(path.str(), node)) { - FG_LOG(FG_INPUT, FG_ALERT, "Failed to read include file " + SG_LOG(SG_INPUT, SG_ALERT, "Failed to read include file " << att_include); _ok = false; } @@ -183,12 +183,12 @@ PropsVisitor::endElement (const char * name) } else if (st.type == "unknown") { ret = st.node->setUnknownValue(_data); } else { - FG_LOG(FG_INPUT, FG_ALERT, "Unknown data type " << st.type + SG_LOG(SG_INPUT, SG_ALERT, "Unknown data type " << st.type << " assuming 'unknown'"); ret = st.node->setUnknownValue(_data); } if (!ret) - FG_LOG(FG_INPUT, FG_ALERT, "readProperties: Failed to set " + SG_LOG(SG_INPUT, SG_ALERT, "readProperties: Failed to set " << st.node->getPath() << " to value \"" << _data << "\" with type " << st.type); } @@ -206,14 +206,14 @@ PropsVisitor::data (const char * s, int length) void PropsVisitor::warning (const char * message, int line, int column) { - FG_LOG(FG_INPUT, FG_ALERT, "readProperties: warning: " + SG_LOG(SG_INPUT, SG_ALERT, "readProperties: warning: " << message << " at line " << line << ", column " << column); } void PropsVisitor::error (const char * message, int line, int column) { - FG_LOG(FG_INPUT, FG_ALERT, "readProperties: FATAL: " << + SG_LOG(SG_INPUT, SG_ALERT, "readProperties: FATAL: " << message << " at line " << line << ", column " << column); _ok = false; } @@ -257,7 +257,7 @@ readProperties (const string &file, SGPropertyNode * start_node) if (input.good()) { return readProperties(input, start_node, file); } else { - FG_LOG(FG_INPUT, FG_ALERT, "Error reading property list from file " + SG_LOG(SG_INPUT, SG_ALERT, "Error reading property list from file " << file); return false; } @@ -416,7 +416,7 @@ writeProperties (const string &file, const SGPropertyNode * start_node) if (output.good()) { return writeProperties(output, start_node); } else { - FG_LOG(FG_INPUT, FG_ALERT, "Cannot write properties to file " + SG_LOG(SG_INPUT, SG_ALERT, "Cannot write properties to file " << file); return false; } diff --git a/simgear/serial/serial.cxx b/simgear/serial/serial.cxx index a46570d2..2c707b18 100644 --- a/simgear/serial/serial.cxx +++ b/simgear/serial/serial.cxx @@ -94,7 +94,7 @@ bool FGSerialPort::open_port(const string& device) { 0, NULL ); - FG_LOG( FG_IO, FG_ALERT, "Error opening serial device \"" + SG_LOG( SG_IO, SG_ALERT, "Error opening serial device \"" << device << "\" " << (const char*) lpMsgBuf ); LocalFree( lpMsgBuf ); return false; @@ -111,7 +111,7 @@ bool FGSerialPort::open_port(const string& device) { cout << "Serial fd created = " << fd << endl; if ( fd == -1 ) { - FG_LOG( FG_IO, FG_ALERT, "Cannot open " << device + SG_LOG( SG_IO, SG_ALERT, "Cannot open " << device << " for serial I/O" ); return false; } else { @@ -120,7 +120,7 @@ bool FGSerialPort::open_port(const string& device) { // set required port parameters if ( tcgetattr( fd, &config ) != 0 ) { - FG_LOG( FG_IO, FG_ALERT, "Unable to poll port settings" ); + SG_LOG( SG_IO, SG_ALERT, "Unable to poll port settings" ); return false; } @@ -142,7 +142,7 @@ bool FGSerialPort::open_port(const string& device) { // cout << "config.c_iflag = " << config.c_iflag << endl; if ( tcsetattr( fd, TCSANOW, &config ) != 0 ) { - FG_LOG( FG_IO, FG_ALERT, "Unable to update port settings" ); + SG_LOG( SG_IO, SG_ALERT, "Unable to update port settings" ); return false; } @@ -176,7 +176,7 @@ bool FGSerialPort::set_baud(int baud) { speed_t speed = B9600; if ( tcgetattr( fd, &config ) != 0 ) { - FG_LOG( FG_IO, FG_ALERT, "Unable to poll port settings" ); + SG_LOG( SG_IO, SG_ALERT, "Unable to poll port settings" ); return false; } @@ -203,22 +203,22 @@ bool FGSerialPort::set_baud(int baud) { speed = B230400; #endif } else { - FG_LOG( FG_IO, FG_ALERT, "Unsupported baud rate " << baud ); + SG_LOG( SG_IO, SG_ALERT, "Unsupported baud rate " << baud ); return false; } if ( cfsetispeed( &config, speed ) != 0 ) { - FG_LOG( FG_IO, FG_ALERT, "Problem setting input baud rate" ); + SG_LOG( SG_IO, SG_ALERT, "Problem setting input baud rate" ); return false; } if ( cfsetospeed( &config, speed ) != 0 ) { - FG_LOG( FG_IO, FG_ALERT, "Problem setting output baud rate" ); + SG_LOG( SG_IO, SG_ALERT, "Problem setting output baud rate" ); return false; } if ( tcsetattr( fd, TCSANOW, &config ) != 0 ) { - FG_LOG( FG_IO, FG_ALERT, "Unable to update port settings" ); + SG_LOG( SG_IO, SG_ALERT, "Unable to update port settings" ); return false; } @@ -248,7 +248,7 @@ string FGSerialPort::read_port() { if ( count < 0 ) { // error condition if ( errno != EAGAIN ) { - FG_LOG( FG_IO, FG_ALERT, + SG_LOG( SG_IO, SG_ALERT, "Serial I/O on read, error number = " << errno ); } @@ -281,7 +281,7 @@ int FGSerialPort::read_port(char *buf, int len) { if ( count < 0 ) { // error condition if ( errno != EAGAIN ) { - FG_LOG( FG_IO, FG_ALERT, + SG_LOG( SG_IO, SG_ALERT, "Serial I/O on read, error number = " << errno ); } @@ -325,7 +325,7 @@ int FGSerialPort::write_port(const string& value) { 0, NULL ); - FG_LOG( FG_IO, FG_ALERT, "Serial I/O write error: " + SG_LOG( SG_IO, SG_ALERT, "Serial I/O write error: " << (const char*) lpMsgBuf ); LocalFree( lpMsgBuf ); return int(lpNumberOfBytesWritten); @@ -339,7 +339,7 @@ int FGSerialPort::write_port(const string& value) { int count; if ( error ) { - FG_LOG( FG_IO, FG_ALERT, "attempting serial write error recovery" ); + SG_LOG( SG_IO, SG_ALERT, "attempting serial write error recovery" ); // attempt some sort of error recovery count = write(fd, "\n", 1); if ( count == 1 ) { @@ -362,7 +362,7 @@ int FGSerialPort::write_port(const string& value) { error = false; } else { error = true; - FG_LOG( FG_IO, FG_ALERT, + SG_LOG( SG_IO, SG_ALERT, "Serial I/O on write, error number = " << errno ); } } @@ -400,7 +400,7 @@ int FGSerialPort::write_port(const char* buf, int len) { 0, NULL ); - FG_LOG( FG_IO, FG_ALERT, "Serial I/O write error: " + SG_LOG( SG_IO, SG_ALERT, "Serial I/O write error: " << (const char*) lpMsgBuf ); LocalFree( lpMsgBuf ); return int(lpNumberOfBytesWritten); @@ -435,7 +435,7 @@ int FGSerialPort::write_port(const char* buf, int len) { // ok ... in our context we don't really care if we can't // write a string, we'll just get it the next time around } else { - FG_LOG( FG_IO, FG_ALERT, + SG_LOG( SG_IO, SG_ALERT, "Serial I/O on write, error number = " << errno ); } } diff --git a/simgear/serial/testserial.cxx b/simgear/serial/testserial.cxx index faab2678..51735138 100644 --- a/simgear/serial/testserial.cxx +++ b/simgear/serial/testserial.cxx @@ -9,7 +9,7 @@ int main () { string value; bool result; - fglog().setLogLevels( FG_ALL, FG_INFO ); + sglog().setLogLevels( SG_ALL, SG_INFO ); cout << "start of main" << endl; diff --git a/simgear/timing/sg_time.cxx b/simgear/timing/sg_time.cxx index 74d53c4f..507c9b35 100644 --- a/simgear/timing/sg_time.cxx +++ b/simgear/timing/sg_time.cxx @@ -72,7 +72,7 @@ static const double SIDRATE = 0.9972695677; SGTime::SGTime( double lon, double lat, const string& root ) { - FG_LOG( FG_EVENT, FG_INFO, "Initializing Time" ); + SG_LOG( SG_EVENT, SG_INFO, "Initializing Time" ); gst_diff = -9999.0; @@ -85,7 +85,7 @@ SGTime::SGTime( double lon, double lat, const string& root ) if ( root != (string)"" ) { FGPath zone( root ); zone.append( "zone.tab" ); - FG_LOG( FG_EVENT, FG_DEBUG, "Reading timezone info from: " + SG_LOG( SG_EVENT, SG_DEBUG, "Reading timezone info from: " << zone.str() ); tzContainer = new TimezoneContainer( zone.c_str() ); @@ -157,13 +157,13 @@ static double sidereal_course( time_t cur_time, struct tm *gmt, double lng ) now = cur_time; start_gmt = sgTimeGetGMT(gmt->tm_year, 2, 21, 12, 0, 0); - FG_LOG( FG_EVENT, FG_DEBUG, " COURSE: GMT = " + SG_LOG( SG_EVENT, SG_DEBUG, " COURSE: GMT = " << sgTimeFormatTime(gmt, tbuf) ); - FG_LOG( FG_EVENT, FG_DEBUG, " March 21 noon (GMT) = " << start_gmt ); + SG_LOG( SG_EVENT, SG_DEBUG, " March 21 noon (GMT) = " << start_gmt ); diff = (now - start_gmt) / (3600.0 * 24.0); - FG_LOG( FG_EVENT, FG_DEBUG, + SG_LOG( SG_EVENT, SG_DEBUG, " Time since 3/21/" << gmt->tm_year << " GMT = " << diff ); part = fmod(diff, 1.0); @@ -176,7 +176,7 @@ static double sidereal_course( time_t cur_time, struct tm *gmt, double lng ) lstTmp += 24.0; } - FG_LOG( FG_EVENT, FG_DEBUG, + SG_LOG( SG_EVENT, SG_DEBUG, " days = " << days << " hours = " << hours << " lon = " << lng << " lst = " << lstTmp ); @@ -188,18 +188,18 @@ static double sidereal_course( time_t cur_time, struct tm *gmt, double lng ) void SGTime::update( double lon, double lat, long int warp ) { double gst_precise, gst_course; - FG_LOG( FG_EVENT, FG_DEBUG, "Updating time" ); + SG_LOG( SG_EVENT, SG_DEBUG, "Updating time" ); // get current Unix calendar time (in seconds) // warp += warp_delta; cur_time = time(NULL) + warp; - FG_LOG( FG_EVENT, FG_DEBUG, + SG_LOG( SG_EVENT, SG_DEBUG, " Current Unix calendar time = " << cur_time << " warp = " << warp ); // get GMT break down for current time gmt = gmtime(&cur_time); - FG_LOG( FG_EVENT, FG_DEBUG, + SG_LOG( SG_EVENT, SG_DEBUG, " Current GMT = " << gmt->tm_mon+1 << "/" << gmt->tm_mday << "/" << gmt->tm_year << " " << gmt->tm_hour << ":" << gmt->tm_min << ":" @@ -217,7 +217,7 @@ void SGTime::update( double lon, double lat, long int warp ) { // convert "back" to Julian date + partial day (as a fraction of one) jd = mjd + MJD0; - FG_LOG( FG_EVENT, FG_DEBUG, " Current Julian Date = " << jd ); + SG_LOG( SG_EVENT, SG_DEBUG, " Current Julian Date = " << jd ); // printf(" Current Longitude = %.3f\n", FG_Longitude * SGD_RADIANS_TO_DEGREES); @@ -225,7 +225,7 @@ void SGTime::update( double lon, double lat, long int warp ) { if ( gst_diff < -100.0 ) { // first time through do the expensive calculation & cheap // calculation to get the difference. - FG_LOG( FG_EVENT, FG_INFO, " First time, doing precise gst" ); + SG_LOG( SG_EVENT, SG_INFO, " First time, doing precise gst" ); gst_precise = gst = sidereal_precise( mjd, 0.00 ); gst_course = sidereal_course( cur_time, gmt, 0.00 ); @@ -238,9 +238,9 @@ void SGTime::update( double lon, double lat, long int warp ) { lst = sidereal_course( cur_time, gmt, -(lon * SGD_RADIANS_TO_DEGREES) ) + gst_diff; } - FG_LOG( FG_EVENT, FG_DEBUG, + SG_LOG( SG_EVENT, SG_DEBUG, " Current lon=0.00 Sidereal Time = " << gst ); - FG_LOG( FG_EVENT, FG_DEBUG, + SG_LOG( SG_EVENT, SG_DEBUG, " Current LOCAL Sidereal Time = " << lst << " (" << sidereal_precise( mjd, -(lon * SGD_RADIANS_TO_DEGREES) ) << ") (diff = " << gst_diff << ")" ); @@ -332,7 +332,7 @@ double sgTimeCalcGST( double mjd ) { x /= 3600.0; gst = (1.0/SIDRATE)*hr + x; - FG_LOG( FG_EVENT, FG_DEBUG, " gst => " << gst ); + SG_LOG( SG_EVENT, SG_DEBUG, " gst => " << gst ); return gst; } @@ -431,16 +431,16 @@ time_t sgTimeGetGMT(int year, int month, int day, int hour, int min, int sec) time_t start = mktime(&mt); - FG_LOG( FG_EVENT, FG_DEBUG, "start1 = " << start ); + SG_LOG( SG_EVENT, SG_DEBUG, "start1 = " << start ); // the ctime() call can screw up time progression on some versions // of Linux - // fgPrintf( FG_EVENT, FG_DEBUG, "start2 = %s", ctime(&start)); - FG_LOG( FG_EVENT, FG_DEBUG, "(tm_isdst = " << mt.tm_isdst << ")" ); + // fgPrintf( SG_EVENT, SG_DEBUG, "start2 = %s", ctime(&start)); + SG_LOG( SG_EVENT, SG_DEBUG, "(tm_isdst = " << mt.tm_isdst << ")" ); timezone = fix_up_timezone( timezone ); # if defined( TIMEZONE_OFFSET_WORKS ) - FG_LOG( FG_EVENT, FG_DEBUG, + SG_LOG( SG_EVENT, SG_DEBUG, "start = " << start << ", timezone = " << timezone ); return( start - timezone ); # else // ! defined( TIMEZONE_OFFSET_WORKS ) @@ -449,19 +449,19 @@ time_t sgTimeGetGMT(int year, int month, int day, int hour, int min, int sec) if ( daylight > 0 ) { daylight = 1; } else if ( daylight < 0 ) { - FG_LOG( FG_EVENT, FG_WARN, + SG_LOG( SG_EVENT, FG_WARN, "OOOPS, problem in sg_time.cxx, no daylight savings info." ); } long int offset = -(timezone / 3600 - daylight); - FG_LOG( FG_EVENT, FG_DEBUG, " Raw time zone offset = " << timezone ); - FG_LOG( FG_EVENT, FG_DEBUG, " Daylight Savings = " << daylight ); - FG_LOG( FG_EVENT, FG_DEBUG, " Local hours from GMT = " << offset ); + SG_LOG( SG_EVENT, SG_DEBUG, " Raw time zone offset = " << timezone ); + SG_LOG( SG_EVENT, SG_DEBUG, " Daylight Savings = " << daylight ); + SG_LOG( SG_EVENT, SG_DEBUG, " Local hours from GMT = " << offset ); long int start_gmt = start - timezone + (daylight * 3600); - FG_LOG( FG_EVENT, FG_DEBUG, " March 21 noon (CST) = " << start ); + SG_LOG( SG_EVENT, SG_DEBUG, " March 21 noon (CST) = " << start ); return ( start_gmt ); # endif // ! defined( TIMEZONE_OFFSET_WORKS )