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 trace.hpp:40
#define static_
This keyword is use to represent a static object. A static object can't be instantiated (constructors...
Definition static.hpp:37
#define core_export_
Define shared library export.
Definition core_export.hpp:13
- Inheritance
- xtd::static_object → xtd::diagnostics::trace
- Header
#include <xtd/diagnostics/trace>
- Namespace
- xtd::diagnostics
- Library
- xtd.core
- Note
- Adding a trace listener to the 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.
- 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.
#define DEBUG
#include <xtd/diagnostics/trace>
#include <xtd/diagnostics/ostream_trace_listener>
#include <xtd/console>
auto main() -> int {
}
static std::ostream out
Gets the standard output stream. A std::basic_ostream<char_t> that represents the standard output str...
Definition console.hpp:52
static void write_line()
Writes the current line terminator to the standard output stream using the specified format informati...
static void write_line()
Writes a line terminator to the trace listeners in the listeners collection.
Definition trace.hpp:343
static bool auto_flush() noexcept
Gets whether Flush should be called on the Listeners after every write.
static listener_collection & listeners() noexcept
Gets the collection of listeners that is monitoring the trace output.
static void unindent() noexcept
Decreases the current indent_level by one.
static void indent() noexcept
Increases the current indent_level by one.
The xtd::diagnostics namespace provides classes that allow you to interact with system processes,...
Definition assert_dialog_result.hpp:10
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10
|
static bool | auto_flush () noexcept |
| Gets whether Flush should be called on the Listeners after every write.
|
|
static void | auto_flush (bool auto_flush) noexcept |
| Sets whether Flush should be called on the 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_collection & | listeners () 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.
|
|
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.
|
|
|
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> |
static void | trace_error (const xtd::string &message, const objects &... 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> |
static void | trace_information (const xtd::string &message, const objects &... 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> |
static void | trace_warning (const xtd::string &message, const objects &... 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.
|
|