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.
|
#include <trace_source.h>
Provides a set of methods and properties that enable applications to trace the execution of code and associate trace messages with their source.
Inherits xtd::object.
Public Member Functions | |
trace_source (const xtd::ustring &name) | |
Initializes a new instance of the Trace_Source class, using the specified name for the source. | |
trace_source (const xtd::ustring &name, xtd::diagnostics::source_levels default_levels) | |
Initializes a new instance of the Trace_Source class, using the specified name for the source. | |
void | close () |
Closes all the trace listeners in the trace listener collection. | |
void | flush () |
Flushes all the trace listeners in the trace listener collection. | |
xtd::diagnostics::trace_listener_collection & | listeners () |
Gets the collection of trace listeners for the trace source. | |
void | listeners (const xtd::diagnostics::trace_listener_collection &listeners) |
Sets the collection of trace listeners for the trace source. | |
const xtd::ustring & | name () const |
Gets the name of the trace source. | |
const xtd::diagnostics::source_switch & | source_switch () const |
Gets the source switch value. | |
void | source_switch (const xtd::diagnostics::source_switch &source_switch) |
Sets the source switch value. | |
template<typename object_t > | |
void | trace_data (const xtd::diagnostics::trace_event_type &event_type, int32_t 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<typename object_t > | |
void | trace_data (const xtd::diagnostics::trace_event_type &event_type, int32_t 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_t id) |
Writes a trace event message to the trace listeners in the listeners collection using the specified event type and event identifier. | |
template<typename ... objects> | |
void | trace_event (const xtd::diagnostics::trace_event_type &event_type, int32_t id, const xtd::ustring &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_event (const xtd::diagnostics::trace_event_type &event_type, int32_t id, const xtd::ustring &message) |
Writes a trace event message to the trace listeners in the listeners collection using the specified event type, event identifier adn message. | |
template<typename ... objects_t> | |
void | trace_information (const xtd::ustring &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. | |
void | trace_information (const xtd::ustring &message) |
Writes an informational message to the trace listeners in the listeners collection using the specified message. | |
template<typename guid_t > | |
void | trace_transfer (int32_t id, const xtd::ustring &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. | |
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. | |
|
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 |
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.
xtd::diagnostics::trace_listener_collection & xtd::diagnostics::trace_source::listeners | ( | ) |
Gets the collection of trace listeners for the trace source.
void xtd::diagnostics::trace_source::listeners | ( | const xtd::diagnostics::trace_listener_collection & | listeners | ) |
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. |
const xtd::ustring & xtd::diagnostics::trace_source::name | ( | ) | const |
Gets the name of the trace source.
const xtd::diagnostics::source_switch & xtd::diagnostics::trace_source::source_switch | ( | ) | const |
Gets the source switch value.
void xtd::diagnostics::trace_source::source_switch | ( | const xtd::diagnostics::source_switch & | source_switch | ) |
Sets the source switch value.
source_switch | A SourceSwitch object representing the source switch value. |
|
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. |
|
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. |
|
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, 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. |
|
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 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. |
void xtd::diagnostics::trace_source::trace_information | ( | const xtd::ustring & | 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 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. |