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::source_filter Class Reference

#include <source_filter.h>

Definition

Indicates whether a listener should trace a message based on the source of a trace.

Namespace
xtd::diagnostics
Library
xtd.core
Remarks
One of several different types of filters can be assigned to a trace listener to provide a layer of screening beyond that provided by the trace switch. The filter can be used to control the level of tracing that is produced by the listener.
This class filters events based on a specific trace source set by the user.
xtd::diagnostics::source_filter overrides the xtd::diagnostics::source_filter::should_trace method and defines a xtd::diagnostics::source_filter::source property that specifies the name of the trace source to be traced by the listener.
Note
This filter is provided because multiple trace sources can simultaneously use the same trace listener.

Inherits xtd::diagnostics::trace_filter.

Public Member Functions

 source_filter (const xtd::ustring &source)
 Initializes a new instance of the xtd::diagnostics::source_filter class, specifying the name of the trace source.
 
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.
 
const xtd::ustringsource () const
 Gets the name of the trace source.
 
void source (const xtd::ustring &source)
 Gets the name of the trace source.
 
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

◆ source_filter()

xtd::diagnostics::source_filter::source_filter ( const xtd::ustring source)

Initializes a new instance of the xtd::diagnostics::source_filter class, specifying the name of the trace source.

Parameters
sourceThe name of the trace source.

Member Function Documentation

◆ should_trace()

bool xtd::diagnostics::source_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 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.

Implements xtd::diagnostics::trace_filter.

◆ source() [1/2]

const xtd::ustring & xtd::diagnostics::source_filter::source ( ) const

Gets the name of the trace source.

Returns
The name of the trace source.

◆ source() [2/2]

void xtd::diagnostics::source_filter::source ( const xtd::ustring source)

Gets the name of the trace source.

Parameters
sourceThe name of the trace source.

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