xtd 0.2.0
Loading...
Searching...
No Matches
xtd::diagnostics::debug Class Reference
Inheritance diagram for xtd::diagnostics::debug:
xtd::static_object

Definition

Provides a set of methods and properties that help you debug the execution of your code. This class cannot be inherited.

Provides a set of methods and properties that help you debug the execution of your code....
Definition debug.h:59
#define static_
This keyword is use to represent a static object. A static object can't be instantiated (constructors...
Definition static.h:37
#define core_export_
Define shared library export.
Definition core_export.h:13
Inheritance
xtd::static_objectxtd::diagnostics::debug
Header
#include <xtd/diagnostics/debug>
Namespace
xtd::diagnostics
Library
xtd.core
Remarks
You can use the properties and methods in the xtd::diagnostics::debug class to instrument release builds. Instrumentation allows you to monitor the health of your application running in real-life settings. Tracing helps you isolate problems and fix them without disturbing a running system.
This class provides methods to display an assert dialog box, and to emit an assertion that will always fail. This class provides write methods in the following variations: xtd::diagnostics::debug::write, xtd::diagnostics::debug::write_line, xtd::diagnostics::debug::write_if, and xtd::diagnostics::debug::write_line_if.
The xtd::diagnostics::boolean_switch and xtd::diagnostics::trace_switch classes provide means to dynamically control the tracing output. You can modify the values of these switches without recompiling your application. For information on using the configuration file to set a switch, see the xtd::diagnostics::switch class and the xtd::diagnostics::trace_switches topic.
You can customize the tracing output's target by adding xtd::diagnostics::trace_listener instances to or removing instances from the xtd::diagnostics::debug::listeners collection. The xtd::diagnostics::debug::listeners collection is shared by both the xtd::diagnostics::debug and the xtd::diagnostics::trace classes; adding a trace listener to either class adds the listener to both. By default, trace output is emitted using the xtd::diagnostics::default_trace_listener class.
Note
Adding a trace listener to the xtd::diagnostics::debug::listeners collection can cause an exception to be thrown while tracing, if a resource used by the trace listener is not available. The conditions and the exception thrown depend on the trace listener and cannot be enumerated in this topic. It may be useful to place calls to the debug methods in try/catch blocks to detect and handle any exceptions from trace listeners.
Remarks
You can modify the level of indentation using the xtd::diagnostics::debug::indent method or the xtd::diagnostics::debug::indent_level property. To modify the indent spacing, use the xtd::diagnostics::debug::indent_size property. You can specify whether to automatically flush the output buffer after each write by setting the xtd::diagnostics::debug::auto_flush property to true.
The debug class provides properties to get or set the level of indent, the xtd::diagnostics::debug::indent_size, and whether to xtd::diagnostics::debug::auto_flush after each write.
You must enable debug mode to use a trace listener. The syntax is compiler specific. If you use other than cmake to manage your build, refer to the documentation of your build manager.
  • To enable debug mode with cmake, add the add_definitions(-DDEBUG) command line in the CMakeLists.txt of your project, or you can add #define DEBUG to the top of your file.
To activate your code if DEBUG is defined, you must enclose calls to the methods of Debug in an #if defined(DEBUG) ... #endif block, and add the /DDEBUG option to the compiler command line or add #define DEBUG to the file.
Examples
The following example uses debug to indicate the beginning and the end of a program's execution. The example also uses the debug::indent and debug::unindent methods to distinguish the tracing output.
// Specify -DDEBUG when compiling or add #define DEBUG in the source file.
#include <xtd/diagnostics/debug>
#include <xtd/diagnostics/ostream_trace_listener>
#include <xtd/console>
using namespace xtd;
using namespace xtd::diagnostics;
auto main() -> int {
debug::listeners().push_back(new_ptr<ostream_trace_listener>(console::out));
debug::write_line("Entering Main");
console::write_line("Hello World.");
debug::write_line("Exiting Main");
}
// This code produces the following output :
//
// Entering Main
// Hello World.
// Exiting Main
static std::ostream out
Gets the standard output stream. A std::basic_ostream<char_t> that represents the standard output str...
Definition console.h:52
static void write_line()
Writes the current line terminator to the standard output stream using the specified format informati...
static void indent() noexcept
Increases the current indent_level by one.
static void write_line()
Writes a line terminator to the trace listeners in the listeners collection.
Definition debug.h:361
static listener_collection & listeners() noexcept
Gets the collection of listeners that is monitoring the trace output.
static bool auto_flush() noexcept
Gets whether xtd::diagnostics::debug::flush should be called on the xtd::diagnostics::debug::Listener...
static void unindent() noexcept
Decreases the current indent_level by one.
The xtd::diagnostics namespace provides classes that allow you to interact with system processes,...
Definition assert_dialog_result.h:10
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10

Public Aliases

using listener_collection = xtd::diagnostics::trace_listener_collection
 Represents a collection of xtd::diagnostics::trace_listener.
 

Public Static Properties

static bool auto_flush () noexcept
 Gets whether xtd::diagnostics::debug::flush should be called on the xtd::diagnostics::debug::Listeners after every write.
 
static void auto_flush (bool auto_flush) noexcept
 Sets whether xtd::diagnostics::debug::flush should be called on the xtd::diagnostics::debug::Listeners after every write.
 
static uint32 indent_level () noexcept
 Gets the indent level.
 
static void indent_level (uint32 indent_level) noexcept
 Sets the indent level.
 
static uint32 indent_size () noexcept
 Gets the number of spaces in an indent.
 
static void indent_size (uint32 indent_size) noexcept
 Sets the number of spaces in an indent.
 
static listener_collectionlisteners () noexcept
 Gets the collection of listeners that is monitoring the trace output.
 
static void listeners (const listener_collection &listeners) noexcept
 Sets the collection of listeners that is monitoring the trace output. @paral$m listeners A xtd::diagnostics::debug::listener_collection that represents a collection of type xtd::diagnostics::trace_listener monitoring the trace output.
 
static bool show_assert_dialog () noexcept
 Gets a value indicating whether the assert dialog should be show.
 
static void show_assert_dialog (bool show_assert_dialog) noexcept
 Sets a value indicating whether the assert dialog should be show.
 
static bool use_global_lock () noexcept
 Gets a value indicating whether the global lock should be used.
 
static void use_global_lock (bool use_global_lock) noexcept
 Sets a value indicating whether the global lock should be used.
 

Public Static Methods

static void cassert (bool condition, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
 Checks for a condition; if the condition is false, displays a message box that shows the call stack.
 
static void cassert (bool condition, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
 Checks for a condition; if the condition is false, displays a message box that shows the call stack.
 
static void cassert (bool condition, const xtd::string &message, const xtd::string &detail_message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
 Checks for a condition; if the condition is false, displays a message box that shows the call stack.
 
static void fail (const xtd::string &message)
 Emits the specified error message.
 
static void fail (const xtd::string &message, const xtd::string &detail_message)
 Emits an error message and a detailed error message.
 
static void flush ()
 Flushes the output buffer and causes buffered data to write to the listeners collection.
 
static void indent () noexcept
 Increases the current indent_level by one.
 
static void print (const xtd::string &message)
 Writes a message followed by a line terminator to the trace listeners in the listeners collection.
 
template<typename ... args_t>
static void print (const xtd::string &format, args_t &&... args)
 Writes a formatted string followed by a line terminator to the trace listeners in the listeners collection.
 
static void trace_error (const xtd::string &message)
 Writes an error message to the trace listeners in the Listeners collection using the specified message.
 
template<typename ... objects_t>
static void trace_error (const xtd::string &message, const objects_t &... args)
 Writes an error message to the trace listeners in the listeners collection using the specified array of objects and formatting information.
 
static void trace_information (const xtd::string &message)
 Writes an informational message to the trace listeners in the listeners collection using the specified message.
 
template<typename ... objects_t>
static void trace_information (const xtd::string &message, const objects_t &... args)
 Writes an informational message to the trace listeners in the listeners collection using the specified array of objects and formatting information.
 
static void trace_warning (const xtd::string &message)
 Writes a warning message to the trace listeners in the listeners collection using the specified message.
 
template<typename ... objects_t>
static void trace_warning (const xtd::string &message, const objects_t &... args)
 Writes a warning message to the trace listeners in the listeners collection using the specified array of objects and formatting information.
 
static void unindent () noexcept
 Decreases the current indent_level by one.
 
static void write (const xtd::string &message)
 Writes a message to the trace listeners in the listeners collection.
 
template<typename object_t >
static void write (const object_t &message)
 Writes a message to the trace listeners in the listeners collection.
 
template<typename object_t >
static void write (const object_t &message, const xtd::string &category)
 Writes a category name and message to the trace listeners in the listeners collection.
 
template<typename ... args_t>
static void write (const xtd::string &format, args_t &&... args)
 Writes a formatted string to the trace listeners in the listeners collection.
 
static void write_if (bool condition, const xtd::string &message)
 Writes a message to the trace listeners in the Listeners collection if a condition is true.
 
template<typename object_t >
static void write_if (bool condition, const object_t &message)
 Writes a message to the trace listeners in the Listeners collection if a condition is true.
 
template<typename object_t >
static void write_if (bool condition, const object_t &message, const xtd::string &category)
 Writes a category name and message to the trace listeners in the Listeners collection if a condition is true.
 
static void write_line ()
 Writes a line terminator to the trace listeners in the listeners collection.
 
static void write_line (const xtd::string &message)
 Writes a message followed by a line terminator to the trace listeners in the listeners collection.
 
template<typename object_t >
static void write_line (const object_t &message)
 Writes a message followed by a line terminator to the trace listeners in the listeners collection.
 
template<typename object_t >
static void write_line (const object_t &message, const xtd::string &category)
 Writes a category name and message followed by a line terminator to the trace listeners in the listeners collection.
 
template<typename ... args_t>
static void write_line (const xtd::string &format, args_t &&... args)
 Writes a formatted string followed by a line terminator to the trace listeners in the listeners collection.
 
static void write_line_if (bool condition, const xtd::string &message)
 Writes a message followed by a line terminator to the trace listeners in the Listeners collection if a condition is true.
 
template<typename object_t >
static void write_line_if (bool condition, const object_t &message)
 Writes a message followed by a line terminator to the trace listeners in the Listeners collection if a condition is true.
 
template<typename object_t >
static void write_line_if (bool condition, const object_t &message, const xtd::string &category)
 Writes a category name and message followed by a line terminator to the trace listeners in the Listeners collection if a condition is true.
 

Member Typedef Documentation

◆ listener_collection

Member Function Documentation

◆ auto_flush() [1/2]

static bool xtd::diagnostics::debug::auto_flush ( )
staticnoexcept

Gets whether xtd::diagnostics::debug::flush should be called on the xtd::diagnostics::debug::Listeners after every write.

Returns
true if xtd::diagnostics::debug::flush is called on the xtd::diagnostics::debug::listeners after every write; otherwise, false.
Remarks
The default is false.
Flushing the stream will not flush its underlying encoder unless you explicitly call xtd::diagnostics::debug::flush or xtd::diagnostics::debug::close. Setting xtd::diagnostics::debug::auto_flush to true means that data will be flushed from the buffer to the stream.

◆ auto_flush() [2/2]

static void xtd::diagnostics::debug::auto_flush ( bool  auto_flush)
staticnoexcept

Sets whether xtd::diagnostics::debug::flush should be called on the xtd::diagnostics::debug::Listeners after every write.

Parameters
auto_flushtrue if xtd::diagnostics::debug::flush is called on the xtd::diagnostics::debug::listeners after every write; otherwise, false.
Remarks
The default is false.
Flushing the stream will not flush its underlying encoder unless you explicitly call xtd::diagnostics::debug::flush or xtd::diagnostics::debug::close. Setting xtd::diagnostics::debug::auto_flush to true means that data will be flushed from the buffer to the stream.

◆ indent_level() [1/2]

static uint32 xtd::diagnostics::debug::indent_level ( )
staticnoexcept

Gets the indent level.

Returns
The indent level. The default is zero.
Remarks
The xtd::diagnostics::debug::indent_level property represents the number of times the indent of size xtd::diagnostics::debug::indent_size is applied. This property is stored on per-thread/per-request basis.

◆ indent_level() [2/2]

static void xtd::diagnostics::debug::indent_level ( uint32  indent_level)
staticnoexcept

Sets the indent level.

Parameters
indent_levelThe indent level. The default is zero.
Remarks
The xtd::diagnostics::debug::indent_level property represents the number of times the indent of size xtd::diagnostics::debug::indent_size is applied. This property is stored on per-thread/per-request basis.

◆ indent_size() [1/2]

static uint32 xtd::diagnostics::debug::indent_size ( )
staticnoexcept

Gets the number of spaces in an indent.

Returns
The number of spaces in an indent. The default is four.
Remarks
A xtd::diagnostics::ostream_trace_listener interprets this number as spaces. An xtd::diagnostics::event_log_trace_listener ignores this value.

◆ indent_size() [2/2]

static void xtd::diagnostics::debug::indent_size ( uint32  indent_size)
staticnoexcept

Sets the number of spaces in an indent.

Parameters
indent_sizeThe number of spaces in an indent. The default is four.
Remarks
A xtd::diagnostics::ostream_trace_listener interprets this number as spaces. An xtd::diagnostics::event_log_trace_listener ignores this value.

◆ listeners() [1/2]

static listener_collection & xtd::diagnostics::debug::listeners ( )
staticnoexcept

Gets the collection of listeners that is monitoring the trace output.

Returns
A xtd::diagnostics::debug::listener_collection that represents a collection of type xtd::diagnostics::trace_listener monitoring the trace output.
Remarks
The xtd::diagnostics::debug::listeners produce formatted output from the trace output. By default, the collection contains an instance of the xtd::diagnostics::default_trace_listener class. If you want to remove the default listener, call the erase method, and pass it the instance of the xtd::diagnostics::default_trace_listener. To redirect output to the console window, add an instance of the xtd::diagnostics::console_trace_listener class.
Note
The xtd::diagnostics::debug::listeners collection is shared by both the xtd::diagnostics::debug and the xtd::diagnostics::trace classes; adding a trace listener to either class adds the listener to both.

◆ listeners() [2/2]

static void xtd::diagnostics::debug::listeners ( const listener_collection listeners)
staticnoexcept

Sets the collection of listeners that is monitoring the trace output. @paral$m listeners A xtd::diagnostics::debug::listener_collection that represents a collection of type xtd::diagnostics::trace_listener monitoring the trace output.

Remarks
The xtd::diagnostics::debug::listeners produce formatted output from the trace output. By default, the collection contains an instance of the xtd::diagnostics::default_trace_listener class. If you want to remove the default listener, call the erase method, and pass it the instance of the xtd::diagnostics::default_trace_listener. To redirect output to the console window, add an instance of the xtd::diagnostics::console_trace_listener class.
Note
The xtd::diagnostics::debug::listeners collection is shared by both the xtd::diagnostics::debug and the xtd::diagnostics::trace classes; adding a trace listener to either class adds the listener to both.

◆ show_assert_dialog() [1/2]

static bool xtd::diagnostics::debug::show_assert_dialog ( )
staticnoexcept

Gets a value indicating whether the assert dialog should be show.

Returns
true if assert dialog is to be shown; otherwise, false. The default is true.
Remarks
The show assert dialog is used when xtd::diagnostics::debug::cassert or xtd::diagnostics::trace::cassert or assert_ is called to ask user to ignore, continue or retry the assert.
Note
The xtd::diagnostics::debug::show_assert_dialog boolean is shared by both the xtd::diagnostics::debug and the xtd::diagnostics::trace classes; updating the boolean to either class modify the show assert dialog to both.
Deprecated:
Replaced by xtd::diagnostics::default_trace_listener::assert_ui_enabled - Will be removed in version 0.4.0.

◆ show_assert_dialog() [2/2]

static void xtd::diagnostics::debug::show_assert_dialog ( bool  show_assert_dialog)
staticnoexcept

Sets a value indicating whether the assert dialog should be show.

Parameters
show_assert_dialogtrue if assert dialog is to be shown; otherwise, false. The default is true.
Remarks
The show assert dialog is used when xtd::diagnostics::debug::cassert or xtd::diagnostics::trace::cassert or assert_ is called to ask user to ignore, continue or retry the assert.
Note
The xtd::diagnostics::debug::show_assert_dialog boolean is shared by both the xtd::diagnostics::debug and the xtd::diagnostics::trace classes; updating the boolean to either class modify the show assert dialog to both.
Deprecated:
Replaced by xtd::diagnostics::default_trace_listener::assert_ui_enabled - Will be removed in version 0.4.0.

◆ use_global_lock() [1/2]

static bool xtd::diagnostics::debug::use_global_lock ( )
staticnoexcept

Gets a value indicating whether the global lock should be used.

Returns
true if the global lock is to be used; otherwise, false. The default is true.
Remarks
The global lock is always used if the trace listener is not thread safe, regardless of the value of xtd::diagnostics::debug::use_global_lock. The IsThreadSafe property is used to determine if the listener is thread safe. The global lock is not used only if the value of UseGlobalLock is false and the value of IsThreadSafe is true. The default behavior is to use the global lock.

◆ use_global_lock() [2/2]

static void xtd::diagnostics::debug::use_global_lock ( bool  use_global_lock)
staticnoexcept

Sets a value indicating whether the global lock should be used.

Parameters
use_global_locktrue if the global lock is to be used; otherwise, false. The default is true.
Remarks
The global lock is always used if the trace listener is not thread safe, regardless of the value of UseGlobalLock. The xtd::diagnostics::debug::is_thread_safe property is used to determine if the listener is thread safe. The global lock is not used only if the value of xtd::diagnostics::debug::use_global_lock is false and the value of xtd::diagnostics::debug::is_thread_safe is true. The default behavior is to use the global lock.

◆ cassert() [1/3]

static void xtd::diagnostics::debug::cassert ( bool  condition,
const xtd::diagnostics::stack_frame stack_frame = xtd::diagnostics::stack_frame::current() 
)
static

Checks for a condition; if the condition is false, displays a message box that shows the call stack.

Parameters
conditionThe conditional expression to evaluate. If the condition is true, a failure message is not sent and the message box is not displayed.
stack_frameThe (optional) stack frame corresponding to the generated assert.

◆ cassert() [2/3]

static void xtd::diagnostics::debug::cassert ( bool  condition,
const xtd::string message,
const xtd::diagnostics::stack_frame stack_frame = xtd::diagnostics::stack_frame::current() 
)
static

Checks for a condition; if the condition is false, displays a message box that shows the call stack.

Parameters
conditionThe conditional expression to evaluate. If the condition is true, a failure message is not sent and the message box is not displayed.
messageThe message to send to the xtd::diagnostics::debug::listeners collection.
stack_frameThe (optional) stack frame corresponding to the generated assert.

◆ cassert() [3/3]

static void xtd::diagnostics::debug::cassert ( bool  condition,
const xtd::string message,
const xtd::string detail_message,
const xtd::diagnostics::stack_frame stack_frame = xtd::diagnostics::stack_frame::current() 
)
static

Checks for a condition; if the condition is false, displays a message box that shows the call stack.

Parameters
conditionThe conditional expression to evaluate. If the condition is true, a failure message is not sent and the message box is not displayed.
messageThe message to send to the xtd::diagnostics::debug::listeners collection.
detail_messageThe detailed message to send to the xtd::diagnostics::debug::listeners collection.
stack_frameThe (optional) stack frame corresponding to the generated assert.

◆ fail() [1/2]

static void xtd::diagnostics::debug::fail ( const xtd::string message)
inlinestatic

Emits the specified error message.

Parameters
messageA message to emit.
Remarks
The default behavior is that the xtd::diagnostics::default_trace_listener outputs the message to a message box when the application is running in user interface mode and to the xtd::diagnostics::trace_listener instances in the xtd::diagnostics::debug::listeners collection.
Note
The display of the message box is dependent on the presence of the xtd::diagnostics::default_trace_listener. If the xtd::diagnostics::default_trace_listener is not in the xtd::diagnostics::debug::listeners collection, the message box is not displayed. The xtd::diagnostics::default_trace_listener can be removed by the <clear>, the <erase>, or by calling the clear method on the xtd::diagnostics::debug::listeners property (xtd::diagnostics::trace::listeners().clear()).

◆ fail() [2/2]

static void xtd::diagnostics::debug::fail ( const xtd::string message,
const xtd::string detail_message 
)
inlinestatic

Emits an error message and a detailed error message.

Parameters
messageA message to emit.
detail_messageA detailed message to emit.
Remarks
The default behavior is that the default_trace_listener outputs the message to a message box when the application is running in user interface mode and to the TraceListener instances in the Listeners collection.
Note
The display of the message box is dependent on the presence of the default_trace_listener. If the default_trace_listener is not in the listeners collection, the message box is not displayed. The default_trace_listener can be removed by the <clear>, the <remove>, or by calling the clear method on the listeners property (xtd::diagnostics::trace::listeners().clear()).

◆ flush()

static void xtd::diagnostics::debug::flush ( )
inlinestatic

Flushes the output buffer and causes buffered data to write to the listeners collection.

◆ indent()

static void xtd::diagnostics::debug::indent ( )
staticnoexcept

Increases the current indent_level by one.

◆ print() [1/2]

static void xtd::diagnostics::debug::print ( const xtd::string message)
inlinestatic

Writes a message followed by a line terminator to the trace listeners in the listeners collection.

Parameters
messageThe message to write.
Remarks
The default line terminator is a carriage return followed by a line feed. By default, the output is written to an instance of default_trace_listener.

◆ print() [2/2]

template<typename ... args_t>
static void xtd::diagnostics::debug::print ( const xtd::string format,
args_t &&...  args 
)
inlinestatic

Writes a formatted string followed by a line terminator to the trace listeners in the listeners collection.

Parameters
formatA composite format string that contains text intermixed with zero or more format items, which correspond to objects in the args array.
...argsAn object array containing zero or more objects to format.
Exceptions
xtd::format_exceptionformat is invalid.
-or-
The number that indicates an argument to format is less than zero, or greater than or equal to the number of specified objects to format.

◆ trace_error() [1/2]

static void xtd::diagnostics::debug::trace_error ( const xtd::string message)
inlinestatic

Writes an error message to the trace listeners in the Listeners collection using the specified message.

Parameters
messageThe informative message to write.
Remarks
trace_error calls the trace_event method for each trace listener, with the trace event type error, passing the informative message as the message string.

◆ trace_error() [2/2]

template<typename ... objects_t>
static void xtd::diagnostics::debug::trace_error ( const xtd::string message,
const objects_t &...  args 
)
inlinestatic

Writes an error message to the trace listeners in the listeners collection using the specified array of objects and formatting information.

Parameters
formatA format string that contains zero or more format items, which correspond to objects in the args array.
...argsAn object array containing zero or more objects to format.
Remarks
trace_error calls the trace_event methods in the trace listeners with the trace event type error, passing the message content as an object array with formatting information.

◆ trace_information() [1/2]

static void xtd::diagnostics::debug::trace_information ( const xtd::string message)
inlinestatic

Writes an informational message to the trace listeners in the listeners collection using the specified message.

Parameters
messageThe informative message to write.
Remarks
trace_information calls the trace_event method for each trace listener, with the trace event type information, passing the informative message as the message string.

◆ trace_information() [2/2]

template<typename ... objects_t>
static void xtd::diagnostics::debug::trace_information ( const xtd::string message,
const objects_t &...  args 
)
inlinestatic

Writes an informational message to the trace listeners in the listeners collection using the specified array of objects and formatting information.

Parameters
formatA format string that contains zero or more format items, which correspond to objects in the args array.
...argsAn object array containing zero or more objects to format.
Remarks
trace_information calls the trace_event methods in the trace listeners with the trace event type information, passing the message content as an object array with formatting information.

◆ trace_warning() [1/2]

static void xtd::diagnostics::debug::trace_warning ( const xtd::string message)
inlinestatic

Writes a warning message to the trace listeners in the listeners collection using the specified message.

Parameters
messageThe informative message to write.
Remarks
trace_warning calls the trace_event method for each trace listener with the trace event type Warning, passing the informative message as the message string.

◆ trace_warning() [2/2]

template<typename ... objects_t>
static void xtd::diagnostics::debug::trace_warning ( const xtd::string message,
const objects_t &...  args 
)
inlinestatic

Writes a warning message to the trace listeners in the listeners collection using the specified array of objects and formatting information.

Parameters
formatA format string that contains zero or more format items, which correspond to objects in the args array.
...argsAn object array containing zero or more objects to format.
Remarks
trace_warning calls the trace_event methods in the trace listeners with the trace event type Warning, passing the message content as an object array with formatting information.

◆ unindent()

static void xtd::diagnostics::debug::unindent ( )
staticnoexcept

Decreases the current indent_level by one.

◆ write() [1/4]

static void xtd::diagnostics::debug::write ( const xtd::string message)
inlinestatic

Writes a message to the trace listeners in the listeners collection.

Parameters
messageA message to write.
Remarks
By default, the output is written to an instance of default_trace_listener.
This method calls the write method of the trace listener.

◆ write() [2/4]

template<typename object_t >
static void xtd::diagnostics::debug::write ( const object_t &  message)
inlinestatic

Writes a message to the trace listeners in the listeners collection.

Parameters
messageA message to write.
Remarks
By default, the output is written to an instance of default_trace_listener.
This method calls the write method of the trace listener.

◆ write() [3/4]

template<typename object_t >
static void xtd::diagnostics::debug::write ( const object_t &  message,
const xtd::string category 
)
inlinestatic

Writes a category name and message to the trace listeners in the listeners collection.

Parameters
messageA message to write.
categoryA category name used to organize the output.
Remarks
By default, the output is written to an instance of default_trace_listener.
Use the category parameter to group output messages.
This method calls the write method of the trace listener.

◆ write() [4/4]

template<typename ... args_t>
static void xtd::diagnostics::debug::write ( const xtd::string format,
args_t &&...  args 
)
inlinestatic

Writes a formatted string to the trace listeners in the listeners collection.

Parameters
formatA composite format string that contains text intermixed with zero or more format items, which correspond to objects in the args array.
...argsAn object array containing zero or more objects to format.
Remarks
By default, the output is written to an instance of default_trace_listener.
This method calls the write method of the trace listener.

◆ write_if() [1/3]

static void xtd::diagnostics::debug::write_if ( bool  condition,
const xtd::string message 
)
inlinestatic

Writes a message to the trace listeners in the Listeners collection if a condition is true.

Parameters
conditiontrue to cause a message to be written; otherwise, false.
messageA message to write.
Remarks
By default, the output is written to an instance of default_trace_listener.
This method calls the write method of the trace listener.

◆ write_if() [2/3]

template<typename object_t >
static void xtd::diagnostics::debug::write_if ( bool  condition,
const object_t &  message 
)
inlinestatic

Writes a message to the trace listeners in the Listeners collection if a condition is true.

Parameters
conditiontrue to cause a message to be written; otherwise, false.
messageA message to write.
Remarks
By default, the output is written to an instance of default_trace_listener.
This method calls the write method of the trace listener.

◆ write_if() [3/3]

template<typename object_t >
static void xtd::diagnostics::debug::write_if ( bool  condition,
const object_t &  message,
const xtd::string category 
)
inlinestatic

Writes a category name and message to the trace listeners in the Listeners collection if a condition is true.

Parameters
conditiontrue to cause a message to be written; otherwise, false.
messageA message to write.
categoryA category name used to organize the output.
Remarks
By default, the output is written to an instance of default_trace_listener.
This method calls the write method of the trace listener.

◆ write_line() [1/5]

static void xtd::diagnostics::debug::write_line ( )
inlinestatic

Writes a line terminator to the trace listeners in the listeners collection.

Parameters
messageA message to write.
Remarks
By default, the output is written to an instance of default_trace_listener.
This method calls the write method of the trace listener.
Examples
debug_form.cpp, h_scroll_bar.cpp, and v_scroll_bar.cpp.

◆ write_line() [2/5]

static void xtd::diagnostics::debug::write_line ( const xtd::string message)
inlinestatic

Writes a message followed by a line terminator to the trace listeners in the listeners collection.

Parameters
messageA message to write.
Remarks
By default, the output is written to an instance of default_trace_listener.
This method calls the write method of the trace listener.

◆ write_line() [3/5]

template<typename object_t >
static void xtd::diagnostics::debug::write_line ( const object_t &  message)
inlinestatic

Writes a message followed by a line terminator to the trace listeners in the listeners collection.

Parameters
messageA message to write.
Remarks
By default, the output is written to an instance of default_trace_listener.
This method calls the write method of the trace listener.

◆ write_line() [4/5]

template<typename object_t >
static void xtd::diagnostics::debug::write_line ( const object_t &  message,
const xtd::string category 
)
inlinestatic

Writes a category name and message followed by a line terminator to the trace listeners in the listeners collection.

Parameters
messageA message to write.
categoryA category name used to organize the output.
Remarks
By default, the output is written to an instance of default_trace_listener.
Use the category parameter to group output messages.
This method calls the write method of the trace listener.

◆ write_line() [5/5]

template<typename ... args_t>
static void xtd::diagnostics::debug::write_line ( const xtd::string format,
args_t &&...  args 
)
inlinestatic

Writes a formatted string followed by a line terminator to the trace listeners in the listeners collection.

Parameters
formatA composite format string that contains text intermixed with zero or more format items, which correspond to objects in the args array.
...argsAn object array containing zero or more objects to format.
Exceptions
xtd::format_exceptionformat is invalid.
-or-
The number that indicates an argument to format is less than zero, or greater than or equal to the number of specified objects to format.

◆ write_line_if() [1/3]

static void xtd::diagnostics::debug::write_line_if ( bool  condition,
const xtd::string message 
)
inlinestatic

Writes a message followed by a line terminator to the trace listeners in the Listeners collection if a condition is true.

Parameters
conditiontrue to cause a message to be written; otherwise, false.
messageA message to write.
Remarks
By default, the output is written to an instance of default_trace_listener.
This method calls the write method of the trace listener.

◆ write_line_if() [2/3]

template<typename object_t >
static void xtd::diagnostics::debug::write_line_if ( bool  condition,
const object_t &  message 
)
inlinestatic

Writes a message followed by a line terminator to the trace listeners in the Listeners collection if a condition is true.

Parameters
conditiontrue to cause a message to be written; otherwise, false.
messageA message to write.
Remarks
By default, the output is written to an instance of default_trace_listener.
This method calls the write method of the trace listener.

◆ write_line_if() [3/3]

template<typename object_t >
static void xtd::diagnostics::debug::write_line_if ( bool  condition,
const object_t &  message,
const xtd::string category 
)
inlinestatic

Writes a category name and message followed by a line terminator to the trace listeners in the Listeners collection if a condition is true.

Parameters
conditiontrue to cause a message to be written; otherwise, false.
messageA message to write.
categoryA category name used to organize the output.
Remarks
By default, the output is written to an instance of default_trace_listener.
This method calls the write method of the trace listener.

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