INTRODUCTION
Overview
Download and Install
Documentation
Publications

REPOSITORY
Libraries

DEVELOPER
Dev Guide
Dashboard

PEOPLE
Contributors
Users

SourceForge.net Logo
Project
Download
Mailing lists

 

         

gbxutilacfr::Tracer Class Reference

Local and remote tracing. More...

#include <tracer.h>

Inherited by gbxutilacfr::TrivialTracer.

List of all members.

Public Member Functions

virtual void print (const std::string &message)=0
 LOCAL INTERFACE.
virtual void info (const std::string &message, int level=1, bool localOnly=false)
virtual void info (const std::string &subsystem, const std::string &message, int level=1, bool localOnly=false)=0
 This version gives the Tracer some hints about a specific subsytem which generated the message.
virtual void warning (const std::string &message, int level=1, bool localOnly=false)
virtual void warning (const std::string &subsystem, const std::string &message, int level=1, bool localOnly=false)=0
 This version gives the Tracer some hints about a specific subsytem which generated the message.
virtual void error (const std::string &message, int level=1, bool localOnly=false)
virtual void error (const std::string &subsystem, const std::string &message, int level=1, bool localOnly=false)=0
 This version gives the Tracer some hints about a specific subsytem which generated the message.
virtual void debug (const std::string &message, int level=1, bool localOnly=false)
virtual void debug (const std::string &subsystem, const std::string &message, int level=1, bool localOnly=false)=0
 This version gives the Tracer some hints about a specific subsytem which generated the message.
virtual int verbosity (TraceType traceType, DestinationType destType=ToAny) const =0
virtual void setSubsystemDebugLevel (const std::string &subsystem, int level=0)
virtual void subsystemDebug (const std::string &subsystem, const std::string &message, int level=1)


Detailed Description

Local and remote tracing.

Tracer is used to log human-readable trace statements, e.g. warnings, error messages, etc (not data).

A single Tracer object is meant to be shared by multiple threads, so the implementation must be thread-safe.

When the tracing message is cheap to generate, simply call one of the tracing functions. The routing to destinations will be performed internally.

//! std::string s = "something is wrong";
//! tracer->error( s );
//! 

If the tracing message is a result of an expensive operation, you many want to perform the tracing test yourself and then call the tracing function. You may test verbosity for specific TraceType / DestinationType combinations or use summary fields AnyTrace and ToAny.

//! Tracer* tracer = context().tracer();
//! if ( tracer.verbosity( gbxutilacfr::Tracer::ErrorTrace, gbxutilacfr::Tracer::ToAny ) > 0 ) {
//!     std::string s = expensiveOperation();
//!     tracer.error( s );
//! }
//! 

Enum gbxutilacfr::TraceType defines types of traced information. Enum gbxutilacfr::DestinationType defines possible tracer destinations are. Verbosity levels range from 0 (nothing) to 10 (everything). The built-in defaults are as follows:

//!                 ToDisplay   ToNetwork   ToLog   ToFile
//! Info                1           0         0       0
//! Warning             1           0         0       0
//! Error              10           0         0       0
//! Debug               0           0         0       0
//! 

See also:
Status

Member Function Documentation

virtual void gbxutilacfr::Tracer::debug ( const std::string &  message,
int  level = 1,
bool  localOnly = false 
) [inline, virtual]

Routing is determined by DebugToXxx parameter. If localOnly is set to TRUE, messages are not sent over the network (useful when traces is caused by network errors).

Reimplemented in gbxutilacfr::TrivialTracer.

References debug().

Referenced by debug(), gbxsickacfr::Driver::Driver(), gbxgarminacfr::Driver::Driver(), gbxsmartbatteryacfr::OceanServerReader::read(), gbxgarminacfr::Driver::read(), gbxiceutilacfr::SafeThread::run(), and gbxsmartbatteryacfr::OceanServer::walk().

virtual void gbxutilacfr::Tracer::error ( const std::string &  message,
int  level = 1,
bool  localOnly = false 
) [inline, virtual]

Routing is determined by ErrorToXxx parameter. If localOnly is set to TRUE, messages are not sent over the network (useful when traces is caused by network errors).

Reimplemented in gbxutilacfr::TrivialTracer.

References error().

Referenced by error(), gbxgarminacfr::Driver::read(), and gbxiceutilacfr::SafeThread::run().

virtual void gbxutilacfr::Tracer::info ( const std::string &  message,
int  level = 1,
bool  localOnly = false 
) [inline, virtual]

Routing is determined by InfoToXxx parameter. If localOnly is set to TRUE, messages are not sent over the network (useful when traces is caused by network errors).

Reimplemented in gbxutilacfr::TrivialTracer.

References info().

Referenced by info().

virtual void gbxutilacfr::Tracer::print ( const std::string &  message  )  [pure virtual]

LOCAL INTERFACE.

Prints out verbatim to stdout. It is never routed over the network.

See also:
info

Implemented in gbxutilacfr::TrivialTracer.

virtual void gbxutilacfr::Tracer::setSubsystemDebugLevel ( const std::string &  subsystem,
int  level = 0 
) [inline, virtual]

EXPERIMENTAL. Sets debug level for an individual subsystem. Only debug-to-display is supported.

virtual void gbxutilacfr::Tracer::subsystemDebug ( const std::string &  subsystem,
const std::string &  message,
int  level = 1 
) [inline, virtual]

EXPERIMENTAL. Debug tracing for an individual subsystem. Only debug-to-display is supported. The maximum traceable level is set per-subsystem with setLevel().

virtual int gbxutilacfr::Tracer::verbosity ( TraceType  traceType,
DestinationType  destType = ToAny 
) const [pure virtual]

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 function yourself before calling error() if there is a significant overhead in forming the tracing string. See class documentation for an example of such usage.

Implemented in gbxutilacfr::TrivialTracer.

virtual void gbxutilacfr::Tracer::warning ( const std::string &  message,
int  level = 1,
bool  localOnly = false 
) [inline, virtual]

Routing is determined by WarningToXxx parameter. If localOnly is set to TRUE, messages are not sent over the network (useful when traces is caused by network errors).

Reimplemented in gbxutilacfr::TrivialTracer.

References warning().

Referenced by gbxutilacfr::TrivialStatus::addSubsystem(), gbxsickacfr::Driver::Driver(), gbxnovatelacfr::Driver::read(), gbxutilacfr::TrivialStatus::removeSubsystem(), gbxsmartbatteryacfr::OceanServer::walk(), and warning().


The documentation for this class was generated from the following file:
 

Generated for GearBox by  doxygen 1.4.5