xtd - Reference Guide  0.1.0
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
xtd::diagnostics::trace_filter Class Referenceabstract

#include <trace_filter.h>

Definition

Provides the base class for trace filter implementations.

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.

Inherits xtd::object.

Inherited by xtd::diagnostics::event_type_filter, and xtd::diagnostics::source_filter.

Public Member Functions

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.
 
- Public Member Functions inherited from xtd::object
 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 size_t get_hash_code () const noexcept
 Serves as a hash function for a particular type.
 
template<typename object_t >
std::unique_ptr< object_t > memberwise_clone () const
 Gets the type of the current instance.
 
virtual xtd::ustring to_string () const noexcept
 Returns a std::string that represents the current object.
 

Protected Member Functions

 trace_filter ()=default
 Initializes a new instance of the trace_filter class.
 
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.
 
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.
 

Additional Inherited Members

- Static Public Member Functions inherited from xtd::object
static bool equals (const object &object_a, const object &object_b) noexcept
 Determines whether the specified object instances are considered equal.
 
static bool reference_equals (const object &object_a, const object &object_b) noexcept
 Determines whether the specified object instances are the same instance.
 

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]

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() [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,
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.

◆ should_trace() [3/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.


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