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.

Inheritance diagram for gbxutilacfr::Tracer:

Inheritance graph
[legend]
List of all members.

Public Types

 InfoTrace = 0
 Information.
 WarningTrace
 Warning.
 ErrorTrace
 Error.
 DebugTrace
 Debug statement.
 AnyTrace
 NumberOfTraceTypes
 Number of trace types.
 OtherTrace
 ToDisplay = 0
 Write to stardard display.
 ToNetwork
 Send over the network, details specific to Tracer implementation.
 ToLog
 Write to SysLog on Unix, EventLog on windows.
 ToFile
 Write to a file.
 ToAny
 NumberOfDestinationTypes
 Number of destination types.
enum  TraceType {
  InfoTrace = 0, WarningTrace, ErrorTrace, DebugTrace,
  AnyTrace, NumberOfTraceTypes, OtherTrace
}
 Types of traced information. More...
enum  DestinationType {
  ToDisplay = 0, ToNetwork, ToLog, ToFile,
  ToAny, NumberOfDestinationTypes
}
 Types of destinations for traced information. More...

Public Member Functions

virtual void print (const std::string &message)=0
 LOCAL INTERFACE.
virtual void info (const std::string &message, int level=1)=0
 Routing is determined by InfoToXxx parameter.
virtual void warning (const std::string &message, int level=1)=0
 Routing is determined by WarningToXxx parameter.
virtual void error (const std::string &message, int level=1)=0
 Routing is determined by ErrorToXxx parameter.
virtual void debug (const std::string &message, int level=1)=0
 Routing is determined by DebugToXxx parameter.
virtual int verbosity (TraceType traceType, DestinationType destType) const =0
virtual void setLevel (const std::string &subsystem, int level=0)
virtual void debug (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::Tracer::TraceType defines types of traced information. Enum gbxutilacfr::Tracer::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 Enumeration Documentation

Types of destinations for traced information.

Enumerator:
ToDisplay  Write to stardard display.
ToNetwork  Send over the network, details specific to Tracer implementation.
ToLog  Write to SysLog on Unix, EventLog on windows.
ToFile  Write to a file.
ToAny  Use this index to request the maximum verbosity of a particular type among all destinations
NumberOfDestinationTypes  Number of destination types.

Types of traced information.

Enumerator:
InfoTrace  Information.
WarningTrace  Warning.
ErrorTrace  Error.
DebugTrace  Debug statement.
AnyTrace  Use this index to find out the maximum verbosity among all trace types to a particular destination.
NumberOfTraceTypes  Number of trace types.
OtherTrace  Other (not used by orcaice tracers, so it's verbosity level is not stored in our matrix, so it's safe to have it larger than NumberOfTraceTypes)


Member Function Documentation

virtual void gbxutilacfr::Tracer::debug ( 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 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::setLevel ( const std::string &  subsystem,
int  level = 0 
) [inline, virtual]

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

virtual int gbxutilacfr::Tracer::verbosity ( TraceType  traceType,
DestinationType  destType 
) 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.


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

Generated for GearBox by  doxygen 1.4.5