From: <rus...@us...> - 2009-01-14 02:46:06
|
Revision: 368 http://gearbox.svn.sourceforge.net/gearbox/?rev=368&view=rev Author: russo2503v Date: 2009-01-14 01:52:30 +0000 (Wed, 14 Jan 2009) Log Message: ----------- added optional parameter to Tracer functions to make tracing local-only. No changes to existing code is required. Modified Paths: -------------- gearbox/trunk/doc/history.dox gearbox/trunk/src/gbxutilacfr/tracer.h gearbox/trunk/src/gbxutilacfr/trivialtracer.cpp gearbox/trunk/src/gbxutilacfr/trivialtracer.h Modified: gearbox/trunk/doc/history.dox =================================================================== --- gearbox/trunk/doc/history.dox 2008-12-19 08:11:45 UTC (rev 367) +++ gearbox/trunk/doc/history.dox 2009-01-14 01:52:30 UTC (rev 368) @@ -34,6 +34,9 @@ - Changed interface for Tracer: - when querying verbosity, default destination argument is 'ToAny' (AlexB). - moved trace type and destination enums out of the class into the namespace (alexm) + - added optional 'localOnly' parameter to all Tracer output function, i.e. info(), warn(), error(), debug(). + This is to allow the use of Tracer for tracing network problems (otherwise a trace of a network problem will + lead to another trace, etc) (alexm) - Changed implementation of TrivialTracer to allow multiple levels of tracing verbosity (AlexB). - Changed interface for Status: - status of subsystems is described in two orthogonal dimensions: state and health. (alexm) Modified: gearbox/trunk/src/gbxutilacfr/tracer.h =================================================================== --- gearbox/trunk/src/gbxutilacfr/tracer.h 2008-12-19 08:11:45 UTC (rev 367) +++ gearbox/trunk/src/gbxutilacfr/tracer.h 2009-01-14 01:52:30 UTC (rev 368) @@ -39,7 +39,7 @@ enum DestinationType { //! Write to stardard display ToDisplay=0, - //! Send over the network, details specific to Tracer implementation + //! Send over the network, details are specific to Tracer implementation ToNetwork, //! Write to SysLog on Unix, EventLog on windows ToLog, @@ -116,16 +116,24 @@ virtual void print( const std::string &message ) = 0; //! Routing is determined by InfoToXxx parameter. - virtual void info( const std::string &message, int level=1 ) = 0; + //! If localOnly is set to TRUE, messages are not sent over the network (useful when traces + //! is caused by network errors). + virtual void info( const std::string &message, int level=1, bool localOnly=false ) = 0; //! Routing is determined by WarningToXxx parameter. - virtual void warning( const std::string &message, int level=1 ) = 0; + //! If localOnly is set to TRUE, messages are not sent over the network (useful when traces + //! is caused by network errors). + virtual void warning( const std::string &message, int level=1, bool localOnly=false ) = 0; //! Routing is determined by ErrorToXxx parameter. - virtual void error( const std::string &message, int level=1 ) = 0; + //! If localOnly is set to TRUE, messages are not sent over the network (useful when traces + //! is caused by network errors). + virtual void error( const std::string &message, int level=1, bool localOnly=false ) = 0; //! Routing is determined by DebugToXxx parameter. - virtual void debug( const std::string &message, int level=1 ) = 0; + //! If localOnly is set to TRUE, messages are not sent over the network (useful when traces + //! is caused by network errors). + virtual void debug( const std::string &message, int level=1, bool localOnly=false ) = 0; //! Returns the verbosity level for traceType to destType. This test is performed //! internally by all tracing functions, e.g. error(). You may want to call this Modified: gearbox/trunk/src/gbxutilacfr/trivialtracer.cpp =================================================================== --- gearbox/trunk/src/gbxutilacfr/trivialtracer.cpp 2008-12-19 08:11:45 UTC (rev 367) +++ gearbox/trunk/src/gbxutilacfr/trivialtracer.cpp 2009-01-14 01:52:30 UTC (rev 368) @@ -31,28 +31,28 @@ } void -TrivialTracer::info( const std::string &message, int level ) +TrivialTracer::info( const std::string &message, int level, bool localOnly ) { if ( traceLevels_[InfoTrace] >= level ) cout << "info: " << message << endl; } void -TrivialTracer::warning( const std::string &message, int level ) +TrivialTracer::warning( const std::string &message, int level, bool localOnly ) { if ( traceLevels_[WarningTrace] >= level ) cout << "warn: " << message << endl; } void -TrivialTracer::error( const std::string &message, int level ) +TrivialTracer::error( const std::string &message, int level, bool localOnly ) { if ( traceLevels_[ErrorTrace] >= level ) cout << "error: " << message << endl; } void -TrivialTracer::debug( const std::string &message, int level ) +TrivialTracer::debug( const std::string &message, int level, bool localOnly ) { if ( traceLevels_[DebugTrace] >= level ) cout << "debug: " << message << endl; Modified: gearbox/trunk/src/gbxutilacfr/trivialtracer.h =================================================================== --- gearbox/trunk/src/gbxutilacfr/trivialtracer.h 2008-12-19 08:11:45 UTC (rev 367) +++ gearbox/trunk/src/gbxutilacfr/trivialtracer.h 2009-01-14 01:52:30 UTC (rev 368) @@ -33,10 +33,10 @@ int error=9 ); virtual void print( const std::string &message ); - virtual void info( const std::string &message, int level=1 ); - virtual void warning( const std::string &message, int level=1 ); - virtual void error( const std::string &message, int level=1 ); - virtual void debug( const std::string &message, int level=1 ); + virtual void info( const std::string &message, int level=1, bool localOnly=false ); + virtual void warning( const std::string &message, int level=1, bool localOnly=false ); + virtual void error( const std::string &message, int level=1, bool localOnly=false ); + virtual void debug( const std::string &message, int level=1, bool localOnly=false ); virtual int verbosity( TraceType traceType, DestinationType destType=ToAny ) const; private: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |