nidas v1.2.3
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
nidas::core::SampleTracer Class Reference

SampleTracer uses a Logger to log messages about samples as they are encountered in the code. More...

#include <SampleTracer.h>

Public Member Functions

 SampleTracer (int level, const char *file, const char *function, int line)
 
bool active (const Sample *samp)
 
bool active (dsm_sample_id_t id)
 
nidas::util::LogMessagemsg (const Sample *samp=0, const std::string &text="")
 Format a basic log message tracing the given the sample, using text as a prefix, then return a reference to this instance's LogMessage so more information can be streamed to it.
 
nidas::util::LogMessagemsg (dsm_time_t tt, dsm_sample_id_t sid, const std::string &text="")
 

Static Public Member Functions

static std::string format_time (dsm_time_t tt)
 
static std::string format_time (dsm_time_t tt, const std::string &format)
 

Private Attributes

nidas::util::LogContext _context
 
nidas::util::LogMessage _msg
 
nidas::core::SampleMatcher _matcher
 

Detailed Description

SampleTracer uses a Logger to log messages about samples as they are encountered in the code.

The samples are selected by ID using a SampleMatcher, whose criteria are specified in the 'trace_samples' log parameter.

Constructor & Destructor Documentation

◆ SampleTracer()

SampleTracer::SampleTracer ( int level,
const char * file,
const char * function,
int line )

Member Function Documentation

◆ active() [1/2]

bool nidas::core::SampleTracer::active ( const Sample * samp)
inline

◆ active() [2/2]

bool nidas::core::SampleTracer::active ( dsm_sample_id_t id)
inline

◆ format_time() [1/2]

static std::string nidas::core::SampleTracer::format_time ( dsm_time_t tt)
inlinestatic

◆ format_time() [2/2]

static std::string nidas::core::SampleTracer::format_time ( dsm_time_t tt,
const std::string & format )
inlinestatic

◆ msg() [1/2]

nidas::util::LogMessage & nidas::core::SampleTracer::msg ( const Sample * samp = 0,
const std::string & text = "" )
inline

Format a basic log message tracing the given the sample, using text as a prefix, then return a reference to this instance's LogMessage so more information can be streamed to it.

The 'endlog' manipulator must be streamed to the return value to actually log the message. For example:

...
if (st.active(samp))
st.msg(samp, "received") << endlog;
SampleTracer uses a Logger to log messages about samples as they are encountered in the code.
Definition SampleTracer.h:23
Sample * getSample(sampleType type, unsigned int len)
A convienence method for getting a sample of an enumerated type from a pool.
Definition Sample.cc:70

With no arguments, no message is added, just the LogMessage reference is returned, allowing more information to be streamed to an existing message.

References _msg, format_time(), GET_DSM_ID, and GET_SPS_ID.

◆ msg() [2/2]

nidas::util::LogMessage & nidas::core::SampleTracer::msg ( dsm_time_t tt,
dsm_sample_id_t sid,
const std::string & text = "" )
inline

Member Data Documentation

◆ _context

nidas::util::LogContext nidas::core::SampleTracer::_context
private

Referenced by active(), and active().

◆ _matcher

nidas::core::SampleMatcher nidas::core::SampleTracer::_matcher
private

Referenced by active(), active(), and SampleTracer().

◆ _msg

nidas::util::LogMessage nidas::core::SampleTracer::_msg
private

Referenced by msg(), and msg().


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