X-TraceC++Library
Static Public Member Functions
xtr::Reporter Class Reference

#include <XtrReporter.h>

Static Public Member Functions

static void init ()
 Sets up any state required to have the class ready to send reports.
static void stop ()
 Cleans up any state set up at init.
static xtr_result sendReport (const char *msg, u_int8_t severity=OptionSeverity::_DEFAULT, u_int8_t severityThreshold=OptionSeverity::_UNSET)
 Sends an X-Trace report to the Ctx's destination.
static xtr_result willReport (u_int8_t severity, u_int8_t severityThreshold=OptionSeverity::_UNSET)
 Returns true if the reporter is initialized and severity <= effective severity threshold.
static xtr_result setSeverityThreshold (u_int8_t severity)
 Severity settings.
static u_int8_t getSeverityThreshold ()
 Returns the currently set severity threshold.

Member Function Documentation

static u_int8_t xtr::Reporter::getSeverityThreshold ( ) [static]

Returns the currently set severity threshold.

static void xtr::Reporter::init ( ) [static]

Sets up any state required to have the class ready to send reports.

static xtr_result xtr::Reporter::sendReport ( const char *  msg,
u_int8_t  severity = OptionSeverity::_DEFAULT,
u_int8_t  severityThreshold = OptionSeverity::_UNSET 
) [static]

Sends an X-Trace report to the Ctx's destination.

Currently this means a local UDP socket running on port 7831.

Parameters:
msga null-terminated C-style string. It will not be changed and can be freed/overwritten after the call.
severitySeverity of the event being reported
severityThresholdSeverity threshold of the metadata in question. Unless this is equal to OptionSeverity::_UNSET, it overrides the internal severity_thresh of this reporter.
Returns:
XTR_SUCCESS if message is sent ok XTR_FAIL_SEVERITY if message fails severity check XTR_FAIL if reporter not initialized or there is some other error.
static xtr_result xtr::Reporter::setSeverityThreshold ( u_int8_t  severity) [static]

Severity settings.

Sets the minimum severity messages must have to be reported.

Parameters:
severityA message with numeric severity M will only be reported by the reporting context with severity threshold R if M <= R. Two special values are allowed:
See also:
Option.h for the definitions of OptionSeverity levels
static void xtr::Reporter::stop ( ) [static]

Cleans up any state set up at init.

static xtr_result xtr::Reporter::willReport ( u_int8_t  severity,
u_int8_t  severityThreshold = OptionSeverity::_UNSET 
) [static]

Returns true if the reporter is initialized and severity <= effective severity threshold.

This function will serve as a HINT as to whether the reporter would report an event of *severity* for a task with severityThreshold. While the comparison is the same as the one made during actual reporting, the result may change if the internal severity threshold changes in between calls.

The effective severity threshold is given by: (severityThreshold == OptionSeverity::_UNSET)?severityThreshold:severity_thresh where severityThreshold is the argument (likely from the current metadata),

Parameters:
severitySeverity of the event being reported
severityThresholdSeverity threshold of the metadata in question. Unless this is equal to OptionSeverity::_UNSET, it overrides the internal severity_thresh of this reporter.
Returns:
XTR_SUCCESS if will report XTR_FAIL_SEVERITY if it won't report because of severity XTR_FAIL if reporter not initialized

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