xtd - Reference Guide  0.2.0
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
List of all members
xtd::diagnostics::trace_filter Class Referenceabstract

#include <trace_filter.h>

Definition

Provides the base class for trace filter implementations.

class core_export_ trace_filter abstract_
Inheritance
xtd::abstract_objectxtd::diagnostics::trace_filter
Namespace
xtd::diagnostics
Library
xtd.core
Remarks
Trace filters can be used by trace listeners to provide an extra layer of filtering beyond that provided by trace switches. The trace filter for a trace listener can be found in the listener's filter property. Trace switches determine if a trace is to be sent to the trace listeners. Trace filters allow the individual trace listeners to determine whether or not the trace is to be written to the associated output medium. For example, as determined by each trace filter, a trace may be written to the console by a console_trace_listener, but not to the event log by a event_log_trace_listener.
Filters that inherit from the trace_filter class can be used by trace listeners that inherit from the trace_listener class to perform filtering of events being traced. trace_filter contains a single method, should_trace, which takes event data and returns a flag indicating whether the event should be traced.

Methods

virtual bool should_trace (const xtd::diagnostics::trace_event_cache &cache, const xtd::ustring &source, xtd::diagnostics::trace_event_type event_type, int32_t id, const xtd::ustring &message, std::any data1, const std::vector< std::any > &data_array)=0
 When overridden in a derived class, determines whether the trace listener should trace the event. More...
 

Protected constructors

 trace_filter ()=default
 Initializes a new instance of the trace_filter class. More...
 

Protectted methods

bool should_trace (const xtd::diagnostics::trace_event_cache &cache, const xtd::ustring &source, xtd::diagnostics::trace_event_type event_type, int32_t id, const xtd::ustring &message)
 determines whether the trace listener should trace the event. More...
 
bool should_trace (const xtd::diagnostics::trace_event_cache &cache, const xtd::ustring &source, xtd::diagnostics::trace_event_type event_type, int32_t id, const xtd::ustring &message, std::any data1)
 determines whether the trace listener should trace the event. More...
 

Constructor & Destructor Documentation

◆ trace_filter()

xtd::diagnostics::trace_filter::trace_filter ( )
protecteddefault

Initializes a new instance of the trace_filter class.

Member Function Documentation

◆ should_trace() [1/3]

virtual bool xtd::diagnostics::trace_filter::should_trace ( const xtd::diagnostics::trace_event_cache cache,
const xtd::ustring source,
xtd::diagnostics::trace_event_type  event_type,
int32_t  id,
const xtd::ustring message,
std::any  data1,
const std::vector< std::any > &  data_array 
)
pure virtual

When overridden in a derived class, determines whether the trace listener should trace the event.

Parameters
cacheThe trace_event_cache that contains information for the trace event.
sourceThe name of the source.
event_typeOne of the trace_event_type values specifying the type of event that has caused the trace
idA trace identifier number.
messageMessage to write.
data1A trace data object.
data_arrayA trace data object.

Implemented in xtd::diagnostics::event_type_filter, and xtd::diagnostics::source_filter.

◆ should_trace() [2/3]

bool xtd::diagnostics::trace_filter::should_trace ( const xtd::diagnostics::trace_event_cache cache,
const xtd::ustring source,
xtd::diagnostics::trace_event_type  event_type,
int32_t  id,
const xtd::ustring message 
)
protected

determines whether the trace listener should trace the event.

Parameters
cacheThe trace_event_cache that contains information for the trace event.
sourceThe name of the source.
event_typeOne of the trace_event_type values specifying the type of event that has caused the trace
idA trace identifier number.
messageMessage to write.

◆ should_trace() [3/3]

bool xtd::diagnostics::trace_filter::should_trace ( const xtd::diagnostics::trace_event_cache cache,
const xtd::ustring source,
xtd::diagnostics::trace_event_type  event_type,
int32_t  id,
const xtd::ustring message,
std::any  data1 
)
protected

determines whether the trace listener should trace the event.

Parameters
cacheThe trace_event_cache that contains information for the trace event.
sourceThe name of the source.
event_typeOne of the trace_event_type values specifying the type of event that has caused the trace
idA trace identifier number.
messageMessage to write.
data1A trace data object.

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