Provides a set of methods and properties that enable applications to trace the execution of code and associate trace messages with their source.
Public Constructors | |
trace_source (const xtd::string &name) | |
Initializes a new instance of the Trace_Source class, using the specified name for the source. | |
trace_source (const xtd::string &name, xtd::diagnostics::source_levels default_levels) | |
Initializes a new instance of the Trace_Source class, using the specified name for the source. | |
Public Properties | |
xtd::diagnostics::trace_listener_collection & | listeners () noexcept |
Gets the collection of trace listeners for the trace source. | |
void | listeners (const xtd::diagnostics::trace_listener_collection &listeners) noexcept |
Sets the collection of trace listeners for the trace source. | |
const xtd::string & | name () const noexcept |
Gets the name of the trace source. | |
const xtd::diagnostics::source_switch & | source_switch () const noexcept |
Gets the source switch value. | |
void | source_switch (const xtd::diagnostics::source_switch &source_switch) noexcept |
Sets the source switch value. | |
Public Methods | |
void | close () |
Closes all the trace listeners in the trace listener collection. | |
void | flush () |
Flushes all the trace listeners in the trace listener collection. | |
template<class object_t > | |
void | trace_data (const xtd::diagnostics::trace_event_type &event_type, int32 id, const object_t &data) |
Writes trace data to the trace listeners in the Listeners collection using the specified event type, event identifier, and trace data. | |
template<class object_t > | |
void | trace_data (const xtd::diagnostics::trace_event_type &event_type, int32 id, const std::vector< object_t > &data) |
Writes trace data to the trace listeners in the Listeners collection using the specified event type, event identifier, and trace data. | |
void | trace_event (const xtd::diagnostics::trace_event_type &event_type, int32 id) |
Writes a trace event message to the trace listeners in the listeners collection using the specified event type and event identifier. | |
void | trace_event (const xtd::diagnostics::trace_event_type &event_type, int32 id, const xtd::string &message) |
Writes a trace event message to the trace listeners in the listeners collection using the specified event type, event identifier adn message. | |
template<class ... objects> | |
void | trace_event (const xtd::diagnostics::trace_event_type &event_type, int32 id, const xtd::string &format, const objects &... args) |
Writes a trace event message to the trace listeners in the listeners collection using the specified event type, event identifier, and argument array and format. | |
void | trace_information (const xtd::string &message) |
Writes an informational message to the trace listeners in the listeners collection using the specified message. | |
template<class ... objects_t> | |
void | trace_information (const xtd::string &format, const objects_t &... args) |
Writes an informational message to the trace listeners in the listeners collection using the specified object array and formatting information. | |
template<class guid_t > | |
void | trace_transfer (int32 id, const xtd::string &message, const guid_t &related_activity_id) |
Writes a trace transfer message to the trace listeners in the listeners collection using the specified numeric identifier, message, and related activity identifier. | |
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::uptr< 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. | |
|
explicit |
Initializes a new instance of the Trace_Source class, using the specified name for the source.
name | The name of the source (typically, the name of the application). |
|
explicit |
Initializes a new instance of the Trace_Source class, using the specified name for the source.
name | The name of the source (typically, the name of the application). |
default_level | A bitwise combination of the enumeration values that specifies the default source level at which to trace |
|
noexcept |
Gets the collection of trace listeners for the trace source.
|
noexcept |
Sets the collection of trace listeners for the trace source.
listeners | A trace_listener_collection that contains the active trace listeners associated with the source. |
|
noexcept |
Gets the name of the trace source.
|
noexcept |
Gets the source switch value.
true
, the listeners are called.
|
noexcept |
Sets the source switch value.
source_switch | A SourceSwitch object representing the source switch value. |
true
, the listeners are called. void xtd::diagnostics::trace_source::close | ( | ) |
Closes all the trace listeners in the trace listener collection.
void xtd::diagnostics::trace_source::flush | ( | ) |
Flushes all the trace listeners in the trace listener collection.
|
inline |
Writes trace data to the trace listeners in the Listeners collection using the specified event type, event identifier, and trace data.
event_type | One of the enumeration values that specifies the event type of the trace data. |
id | A numeric identifier for the event. |
data | The trace data. |
true
, trace_data calls the corresponding trace_data method on all listeners. Otherwise, trace_data returns without calling the listeners' methods.
|
inline |
Writes trace data to the trace listeners in the Listeners collection using the specified event type, event identifier, and trace data.
event_type | One of the enumeration values that specifies the event type of the trace data. |
id | A numeric identifier for the event. |
data | The trace data. |
true
, trace_data calls the corresponding trace_data method on all listeners. Otherwise, trace_data returns without calling the listeners' methods.
|
inline |
Writes a trace event message to the trace listeners in the listeners collection using the specified event type and event identifier.
event_type | One of the enumeration values that specifies the event type of the trace data. |
id | A numeric identifier for the event. |
|
inline |
Writes a trace event message to the trace listeners in the listeners collection using the specified event type, event identifier adn message.
event_type | One of the enumeration values that specifies the event type of the trace data. |
id | A numeric identifier for the event. |
message | The trace message to write. |
|
inline |
Writes a trace event message to the trace listeners in the listeners collection using the specified event type, event identifier, and argument array and format.
event_type | One of the enumeration values that specifies the event type of the trace data. |
id | A numeric identifier for the event. |
format | A composite format string that contains text intermixed with zero or more format items, which correspond to objects in the args array. |
args... | An object array containing zero or more objects to format. |
void xtd::diagnostics::trace_source::trace_information | ( | const xtd::string & | message | ) |
Writes an informational message to the trace listeners in the listeners collection using the specified message.
message | The informative message to write. |
|
inline |
Writes an informational message to the trace listeners in the listeners collection using the specified object array and formatting information.
format | A composite format string that contains text intermixed with zero or more format items, which correspond to objects in the args array. |
args... | An array containing zero or more objects to format. |
|
inline |
Writes a trace transfer message to the trace listeners in the listeners collection using the specified numeric identifier, message, and related activity identifier.
id | A numeric identifier for the event. |
message | The trace message to write. |
related_activity_id | A structure that identifies the related activity. |