nidas  v1.2-1520
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. More...
 
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 ( int  level,
const char *  file,
const char *  function,
int  line 
)

Member Function Documentation

bool nidas::core::SampleTracer::active ( const Sample samp)
inline
bool nidas::core::SampleTracer::active ( dsm_sample_id_t  id)
inline
static std::string nidas::core::SampleTracer::format_time ( dsm_time_t  tt)
inlinestatic
static std::string nidas::core::SampleTracer::format_time ( dsm_time_t  tt,
const std::string &  format 
)
inlinestatic
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:

static SampleTracer st;
...
if (st.active(samp))
st.msg(samp, "received") << endlog;

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.

Referenced by nidas::core::SampleSorter::run(), and nidas::dynld::raf::SyncRecordSource::slog().

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

Member Data Documentation

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

Referenced by active().

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

Referenced by active(), and SampleTracer().

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

Referenced by msg().


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