xtd 0.2.0
Loading...
Searching...
No Matches
xtd::diagnostics::trace_filter Class Referenceabstract
Inheritance diagram for xtd::diagnostics::trace_filter:
xtd::abstract_object xtd::object xtd::diagnostics::event_type_filter xtd::diagnostics::source_filter

Definition

Provides the base class for trace filter implementations.

class core_export_ trace_filter abstract_
trace_filter()=default
Initializes a new instance of the trace_filter class.
#define core_export_
Define shared library export.
Definition core_export.hpp:13
Inheritance
xtd::objectxtd::abstract_objectxtd::diagnostics::trace_filter
Header
#include <xtd/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.

Public Methods

virtual bool should_trace (const xtd::diagnostics::trace_event_cache &cache, const xtd::string &source, xtd::diagnostics::trace_event_type event_type, int32 id, const xtd::string &message, xtd::any_object data1, const xtd::collections::generic::list< xtd::any_object > &data_array) noexcept=0
 When overridden in a derived class, determines whether the trace listener should trace the event.
 

Protected constructors

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

Protectted methods

bool should_trace (const xtd::diagnostics::trace_event_cache &cache, const xtd::string &source, xtd::diagnostics::trace_event_type event_type, int32 id, const xtd::string &message) noexcept
 determines whether the trace listener should trace the event.
 
bool should_trace (const xtd::diagnostics::trace_event_cache &cache, const xtd::string &source, xtd::diagnostics::trace_event_type event_type, int32 id, const xtd::string &message, xtd::any_object data1) noexcept
 determines whether the trace listener should trace the event.
 

Additional Inherited Members

 object ()=default
 Create a new instance of the ultimate base class object.
 
virtual bool equals (const object &obj) const noexcept
 Determines whether the specified object is equal to the current object.
 
virtual xtd::size get_hash_code () const noexcept
 Serves as a hash function for a particular type.
 
virtual type_object get_type () const noexcept
 Gets the type of the current instance.
 
template<class object_t>
xtd::unique_ptr_object< object_t > memberwise_clone () const
 Creates a shallow copy of the current object.
 
virtual xtd::string to_string () const noexcept
 Returns a xtd::string that represents the current object.
 
template<class object_a_t, class object_b_t>
static bool equals (const object_a_t &object_a, const object_b_t &object_b) noexcept
 Determines whether the specified object instances are considered equal.
 
template<class object_a_t, class object_b_t>
static bool reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept
 Determines whether the specified object instances are the same instance.
 
 abstract_object ()=default
 Initializes a new instance of the xtd::abstract_object class.
 

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::string & source,
xtd::diagnostics::trace_event_type event_type,
int32 id,
const xtd::string & message,
xtd::any_object data1,
const xtd::collections::generic::list< xtd::any_object > & data_array )
pure virtualnoexcept

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::string & source,
xtd::diagnostics::trace_event_type event_type,
int32 id,
const xtd::string & message )
protectednoexcept

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::string & source,
xtd::diagnostics::trace_event_type event_type,
int32 id,
const xtd::string & message,
xtd::any_object data1 )
protectednoexcept

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: