7#include "../add_last_arg_to_command.h"
8#include "../core_export.h"
9#include "../environment.h"
26 namespace diagnostics {
80 static
void auto_flush(
bool auto_flush) noexcept;
85 static
uint32 indent_level() noexcept;
89 static
void indent_level(
uint32 indent_level) noexcept;
94 static
uint32 indent_size() noexcept;
98 static
void indent_size(
uint32 indent_size) noexcept;
117 static
bool show_assert_dialog() noexcept;
124 static
void show_assert_dialog(
bool show_assert_dialog) noexcept;
129 static
bool use_global_lock() noexcept;
133 static
void use_global_lock(
bool use_global_lock) noexcept;
144 static
void cassert(
bool condition);
148 static
void cassert(
bool condition, const
xtd::
string& message);
158 static
void cassert(
bool condition, const
xtd::
string& message, const
xtd::
string& detail_message);
174 static
void fail(const
xtd::
string& message) {
175 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
185 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
186 fail__(message, detail_message);
192 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
203 static
void print(const
xtd::
string& message) {
204 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
205 write_line_(message);
212 template<
typename ...args_t>
214 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
219 template<
typename ...args_t>
220 static void print(
const char* format, args_t&& ... args) {
221 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
231 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
232 trace_event_(trace_event_type::error, message);
239 template<
typename ...objects_t>
241 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
250 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
251 trace_event_(trace_event_type::information, message);
258 template<
typename ...objects_t>
260 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
269 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
270 trace_event_(trace_event_type::warning, message);
277 template<
typename ...objects_t>
279 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
291 static
void write(const
xtd::
string& message) {
292 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
300 template<
typename object_t>
301 static void write(
const object_t& message) {
302 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
312 template<
typename object_t>
314 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
323 template<
typename ...args_t>
325 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
326 write_(string::format(format, args...));
330 template<
typename ...args_t>
331 static void write(
const char* format, args_t&& ... args) {
332 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
333 write_(string::format(format, args...));
344 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
345 if (condition) write_(message);
348 template<
typename object_t>
354 static void write_if(
bool condition,
const object_t& message) {
355 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
365 template<
typename object_t>
367 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
377 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
386 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
387 write_line_(message);
394 template<
typename object_t>
396 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
406 template<
typename object_t>
408 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
416 template<
typename ...args_t>
418 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
419 write_line_(string::format(format, args...));
423 template<
typename ...args_t>
424 static void write_line(
const char* format, args_t&& ... args) {
425 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
426 write_line_(string::format(format, args...));
437 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
438 if (condition) write_line_(message);
446 template<
typename object_t>
448 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
449 if (condition) write_line_(message);
458 template<
typename object_t>
460 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
461 if (condition) write_line_(message, category);
467 static inline bool __should_aborted__(
bool condition,
const xtd::string& message) {
return __should_aborted__(condition, message,
csf_);}
470 static inline bool __should_aborted__(
bool condition,
const xtd::string& message,
const xtd::string& detail_message) {
return __should_aborted__(condition, message, detail_message,
csf_);}
472 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
473 auto result = xtd::diagnostics::debug::assert_dialog(condition, message, detail_message, stack_frame);
487 static bool internal_show_assert_dialog() noexcept;
488 static
void fail__(const
xtd::
string& message);
489 static
void fail__(const
xtd::
string& message, const
xtd::
string& detail_message);
490 static
void flush_();
491 static
void trace_event_(trace_event_type trace_event_type, const
xtd::
string& message);
492 static
void write_(const
xtd::
string& message);
493 static
void write_(const
xtd::
string& message, const
xtd::
string& category);
494 static
void write_line_(const
xtd::
string& message);
495 static
void write_line_(const
xtd::
string& message, const
xtd::
string& category);
497 inline static
bool auto_flush_ = false;
498 inline static uint32 indent_level_ = 0;
499 inline static uint32 indent_size_ = 4;
500 static listener_collection& listeners_;
501 static
xtd::
string source_name_;
529#define cassert_(...) \
530 add_last_arg_to_command_(cassert, (csf_), __VA_ARGS__)
Contains xtd::diagnostics::assert_dialog_result enum class.
static const basic_string empty_string
Represents the empty basic_string.
Definition basic_string.h:124
Represents text as a sequence of character units.
Definition basic_string.h:79
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 ...
Definition debug.h:366
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 specifie...
Definition debug.h:259
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:376
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.
Definition debug.h:313
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 ...
Definition debug.h:447
static void write_line(const object_t &message)
Writes a message followed by a line terminator to the trace listeners in the listeners collection.
Definition debug.h:395
static void write(const xtd::string &format, args_t &&... args)
Writes a formatted string to the trace listeners in the listeners collection.
Definition debug.h:324
static bool auto_flush() noexcept
Gets whether xtd::diagnostics::debug::flush should be called on the xtd::diagnostics::debug::Listener...
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 ...
Definition debug.h:240
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 Listen...
Definition debug.h:459
static void fail(const xtd::string &message, const xtd::string &detail_message)
Emits an error message and a detailed error message.
Definition debug.h:184
static void write_line(const xtd::string &message)
Writes a message followed by a line terminator to the trace listeners in the listeners collection.
Definition debug.h:385
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.
Definition debug.h:354
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 colle...
Definition debug.h:213
static void trace_error(const xtd::string &message)
Writes an error message to the trace listeners in the Listeners collection using the specified messag...
Definition debug.h:230
static void trace_warning(const xtd::string &message)
Writes a warning message to the trace listeners in the listeners collection using the specified messa...
Definition debug.h:268
static void write(const object_t &message)
Writes a message to the trace listeners in the listeners collection.
Definition debug.h:301
static void flush()
Flushes the output buffer and causes buffered data to write to the listeners collection.
Definition debug.h:191
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 colle...
Definition debug.h:417
static void unindent() noexcept
Decreases the current indent_level by one.
static void trace_information(const xtd::string &message)
Writes an informational message to the trace listeners in the listeners collection using the specifie...
Definition debug.h:249
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 listen...
Definition debug.h:407
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...
Definition debug.h:278
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.
Definition debug.h:343
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 ...
Definition debug.h:436
Provides a set of methods and properties that help you debug the execution of your code....
Definition debug.h:59
Provides the default output methods and behavior for tracing.
Definition default_trace_listener.h:33
Provides information about a xtd::diagnostics::stack_frame, which represents a function call on the c...
Definition stack_frame.h:40
Represents a collection of xtd::diagnostics::trace_listener.
Definition trace_listener_collection.h:29
static void exit()
Terminates this process and returns an exit code to the operating system.
Represents the version number of an assembly, operating system, or the xtd. This class cannot be inhe...
Definition version.h:114
Contains xtd::diagnostics::debugger class.
#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
#define csf_
Provides information about the current stack frame.
Definition current_stack_frame.h:30
uint32_t uint32
Represents a 32-bit unsigned integer.
Definition uint32.h:23
assert_dialog_result
Specifies identifiers to indicate the return value of an assert dialog box.
Definition assert_dialog_result.h:25
@ retry
The assert dialog return value is Retry (usually sent from a button labeled Retry).
@ abort
The assert dialog return value is Abort (usually sent from a button labeled Abort).
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10
Contains xtd::diagnostics::stack_trace class.
Contains xtd::diagnostics::trace_listener_collection class.