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 | List of all members
xtd::diagnostics::event_type_filter Class Reference

#include <event_type_filter.h>

Definition

Indicates whether a listener should trace based on the event type.

Namespace
xtd::diagnostics
Library
xtd.core
Remarks
One of several different types of filters can be assigned to a trace listener through the xtd::diagnostics::trace_listener::filter property to provide a layer of screening beyond that provided by the xtd::diagnostics::trace_switch. The filter can be used to control the event types that are produced by the listener.
This class filters events based on the value of the xtd::diagnostics::event_type_filter::event_type property. This property can be set by code to specify the event type of messages that should be traced by the listener. The value of the property indicates the threshold at which to begin tracing. Event types at and above the specified level are traced. The xtd::diagnostics::event_type_filter::should_trace method, called by listeners to determine if an event should be traced, uses the value of the xtd::diagnostics::event_type_filter::event_type property.

Inherits xtd::diagnostics::trace_filter.

Public Member Functions

 event_type_filter (xtd::diagnostics::source_levels level)
 Initializes a new instance of the event_type_filter class.
 
xtd::diagnostics::source_levels event_type () const
 Gets the event type of the messages to trace.
 
void event_type (xtd::diagnostics::source_levels level)
 Sets the event type of the messages to trace.
 
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) override
 Determines whether the trace listener should trace the event.
 
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.
 

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.
 
- Protected Member Functions inherited from xtd::diagnostics::trace_filter
 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.
 

Constructor & Destructor Documentation

◆ event_type_filter()

xtd::diagnostics::event_type_filter::event_type_filter ( xtd::diagnostics::source_levels  level)

Initializes a new instance of the event_type_filter class.

Parameters
levelA bitwise combination of the xtd::diagnostics::source_levels values that specifies the event type of the messages to trace.

Member Function Documentation

◆ event_type() [1/2]

xtd::diagnostics::source_levels xtd::diagnostics::event_type_filter::event_type ( ) const

Gets the event type of the messages to trace.

Returns
A bitwise combination of the xtd::diagnostics::source_levels values.
Remarks
The xtd::diagnostics::event_type_filter::event_type property indicates the level at which to trace.

◆ event_type() [2/2]

void xtd::diagnostics::event_type_filter::event_type ( xtd::diagnostics::source_levels  level)

Sets the event type of the messages to trace.

Parameters
levelA bitwise combination of the xtd::diagnostics::source_levels values.
Remarks
The xtd::diagnostics::event_type_filter::event_type property indicates the level at which to trace.

◆ should_trace()

bool xtd::diagnostics::event_type_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 
)
overridevirtual

Determines whether the trace listener should trace the event.

Parameters
cacheThe xtd::diagnostics::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.
Remarks
If the value of the event_type parameter is greater than or equal to the value of the xtd::diagnostics::event_type_filter::event_type property, the method returns true.

Implements xtd::diagnostics::trace_filter.


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