Provides a multilevel switch to control tracing and debug output without recompiling your code.
Public Constructors | |
trace_switch (const xtd::string &display_name, const xtd::string &description) | |
Initializes a new instance of the xtd::diagnostics::trace_switch class, using the specified display name and description. | |
trace_switch (const xtd::string &display_name, const xtd::string &description, const xtd::string &default_switch_value) | |
Initializes a new instance of the xtd::diagnostics::trace_switch class, using the specified display name, description, and default value for the switch. | |
Public Properties | |
xtd::diagnostics::trace_level | level () const noexcept |
Gets the trace level that determines the messages the switch allows. | |
void | level (xtd::diagnostics::trace_level level) noexcept |
Sets the trace level that determines the messages the switch allows. | |
bool | trace_error () const noexcept |
Gets a value indicating whether the switch allows error-handling messages. | |
bool | trace_info () const noexcept |
Gets a value indicating whether the switch allows informational messages. | |
bool | trace_verbose () const noexcept |
Gets a value indicating whether the switch allows all messages. | |
bool | trace_warning () const noexcept |
Gets a value indicating whether the switch allows warning messages. | |
Protected Methods | |
void | on_switch_setting_changed () override |
Invoked when the switch_setting property is changed. | |
void | on_value_changed () override |
Invoked when the value property is changed. | |
Additional Inherited Members | |
![]() | |
const xtd::collections::generic::dictionary< xtd::string, xtd::string > & | attributes () const noexcept |
Gets the custom switch attributes. | |
xtd::collections::generic::dictionary< xtd::string, xtd::string > & | attributes () noexcept |
Gets the custom switch attributes. | |
void | attributes (const xtd::collections::generic::dictionary< xtd::string, xtd::string > &attributes) noexcept |
Sets the custom switch attributes. | |
const xtd::string & | description () const noexcept |
Gets a description of the switch. | |
const xtd::string & | display_name () const noexcept |
Gets a name used to identify the switch. | |
bool | equals (const xtd::object &obj) const noexcept override |
Determines whether the specified object is equal to the current object. | |
bool | equals (const switch_base &other) const noexcept override |
Determines whether the specified object is equal to the current object. | |
![]() | |
object ()=default | |
Create a new instance of the ultimate base class 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. | |
![]() | |
virtual bool | equals (const switch_base &) const noexcept=0 |
Indicates whether the current object is equal to another object of the same type. | |
![]() | |
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. | |
![]() | |
switch_base (const xtd::string &display_name, const xtd::string &description) | |
Initializes a new instance of the switch_base class. | |
switch_base (const xtd::string &display_name, const xtd::string &description, const xtd::string &default_switch_value) | |
Initializes a new instance of the switch_base class. | |
int32 | switch_setting () const noexcept |
Gets the current setting for this switch. | |
void | switch_setting (int32 switch_setting) |
Sets the current setting for this switch. | |
const xtd::string & | value () const noexcept |
Gets the value of the switch. | |
void | value (const xtd::string &value) |
Sets the value of the switch. | |
virtual xtd::array< xtd::string > | get_supported_attributes () const noexcept |
Gets the custom attributes supported by the switch. | |
xtd::diagnostics::trace_switch::trace_switch | ( | const xtd::string & | display_name, |
const xtd::string & | description | ||
) |
Initializes a new instance of the xtd::diagnostics::trace_switch class, using the specified display name and description.
display_name | The name to display on a user interface. |
description | The description of the switch. |
xtd::diagnostics::trace_switch::trace_switch | ( | const xtd::string & | display_name, |
const xtd::string & | description, | ||
const xtd::string & | default_switch_value | ||
) |
Initializes a new instance of the xtd::diagnostics::trace_switch class, using the specified display name, description, and default value for the switch.
display_name | The name to display on a user interface. |
description | The description of the switch. |
default_switch_value | The default value of the switch. |
|
noexcept |
Gets the trace level that determines the messages the switch allows.
|
noexcept |
Sets the trace level that determines the messages the switch allows.
level | One of the xtd::diagnostics::trace_level values that specifies the level of messages that are allowed by the switch. |
|
noexcept |
Gets a value indicating whether the switch allows error-handling messages.
true
if the xtd::diagnostics::trace_switch::level property is set to xtd::diagnostics::trace_level::error, xtd::diagnostics::trace_level::warning, xtd::diagnostics::trace_level::info, or xtd::diagnostics::trace_level::verbose; otherwise, false
.
|
noexcept |
Gets a value indicating whether the switch allows informational messages.
true
if the xtd::diagnostics::trace_switch::level property is set to xtd::diagnostics::trace_level::info, or xtd::diagnostics::trace_level::verbose; otherwise, false
.
|
noexcept |
Gets a value indicating whether the switch allows all messages.
true
if the xtd::diagnostics::trace_switch::level property is set to xtd::diagnostics::trace_level::verbose; otherwise, false
.
|
noexcept |
Gets a value indicating whether the switch allows warning messages.
true
if the xtd::diagnostics::trace_switch::level property is set to xtd::diagnostics::trace_level::warning, xtd::diagnostics::trace_level::info, or xtd::diagnostics::trace_level::verbose; otherwise, false
.
|
overrideprotectedvirtual |
Invoked when the switch_setting property is changed.
Reimplemented from xtd::diagnostics::switch_base.
|
overrideprotectedvirtual |
Invoked when the value property is changed.
Reimplemented from xtd::diagnostics::switch_base.