8 #include "../add_last_arg_to_command.h" 9 #include "../core_export.h" 10 #include "../environment.h" 11 #include "../static.h" 12 #include "../ustring.h" 21 namespace diagnostics {
66 static bool auto_flush();
71 static void auto_flush(
bool auto_flush);
76 static uint32_t indent_level();
80 static void indent_level(uint32_t indent_level);
85 static uint32_t indent_size();
89 static void indent_size(uint32_t indent_size);
106 static bool show_assert_dialog();
111 static void show_assert_dialog(
bool show_assert_dialog);
116 static bool use_global_lock();
120 static void use_global_lock(
bool use_global_lock);
131 static void cassert(
bool condition);
135 static void cassert(
bool condition,
const xtd::ustring& message);
151 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 161 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 162 fail__(message, detail_message);
168 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 174 static void indent();
180 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 181 write_line_(message);
188 template<
typename ...args_t>
190 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 195 template<
typename ...args_t>
196 static void print(
const char* format, args_t&& ... args) {
197 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 207 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 215 template<
typename ...objects_t>
217 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 226 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 234 template<
typename ...objects_t>
236 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 245 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 253 template<
typename ...objects_t>
255 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 261 static void unindent();
268 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 276 template<
typename object_t>
277 static void write(
const object_t& message) {
278 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 288 template<
typename object_t>
290 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 299 template<
typename ...args_t>
301 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 306 template<
typename ...args_t>
307 static void write(
const char* format, args_t&& ... args) {
308 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 320 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 321 if (condition) write_(message);
324 template<
typename object_t>
330 static void write_if(
bool condition,
const object_t& message) {
331 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 341 template<
typename object_t>
343 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 353 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 362 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 363 write_line_(message);
370 template<
typename object_t>
372 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 382 template<
typename object_t>
384 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 392 template<
typename ...args_t>
394 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 399 template<
typename ...args_t>
400 static void write_line(
const char* format, args_t&& ... args) {
401 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 413 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 414 if (condition) write_line_(message);
422 template<
typename object_t>
424 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 425 if (condition) write_line_(message);
434 template<
typename object_t>
436 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 437 if (condition) write_line_(message, category);
442 static inline bool __should_aborted__(
bool condition) {
return __should_aborted__(condition,
"",
csf_);}
443 static inline bool __should_aborted__(
bool condition,
const xtd::ustring& message) {
return __should_aborted__(condition, message,
csf_);}
446 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE) 447 auto result = xtd::diagnostics::debug::assert_dialog(condition, message, stack_frame);
461 static void flush_();
468 inline static bool auto_flush_ =
false;
469 inline static unsigned int indent_level_ = 0;
470 inline static unsigned int indent_size_ = 4;
472 static bool& show_assert_dialog_;
473 inline static bool use_global_lock_ =
true;
474 static std::mutex global_lock_;
496 #define cassert_(...) \ 497 add_last_arg_to_command_(cassert, (csf_), __VA_ARGS__) 511 #define assert_(...) \ 512 if (xtd::diagnostics::debug::add_last_arg_to_command_(__should_aborted__, (csf_), __VA_ARGS__)) debug_break_() Contains xtd::diagnostics::stack_trace class.
static void trace_warning(const xtd::ustring &message)
Writes a warning message to the trace listeners in the listeners collection using the specified messa...
Definition: debug.h:244
Contains xtd::diagnostics::debugger class.
static void write_if(bool condition, const xtd::ustring &message)
Writes a message to the trace listeners in the Listeners collection if a condition is true...
Definition: debug.h:319
static void print(const xtd::ustring &format, args_t &&... args)
Writes a formatted string followed by a line terminator to the trace listeners in the listeners colle...
Definition: debug.h:189
static void trace_error(const xtd::ustring &message)
Writes an error message to the trace listeners in the Listeners collection using the specified messag...
Definition: debug.h:206
#define static_
This keyword is use to represent a static object. A static object can't be instantiated (constructors...
Definition: static.h:38
static void trace_error(const xtd::ustring &message, const objects_t &... args)
Writes an error message to the trace listeners in the listeners collection using the specified array ...
Definition: debug.h:216
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
static void write(const xtd::ustring &format, args_t &&... args)
Writes a formatted string to the trace listeners in the listeners collection.
Definition: debug.h:300
#define csf_
Provides information about the current stack frame.
Definition: stack_frame.h:231
static void write_if(bool condition, const object_t &message, const xtd::ustring &category)
Writes a category name and message to the trace listeners in the Listeners collection if a condition ...
Definition: debug.h:342
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:50
Warning Noncritical problem.
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:423
The assert dialog return value is Abort (usually sent from a button labeled Abort).
static void fail(const xtd::ustring &message)
Emits the specified error message.
Definition: debug.h:150
assert_dialog_result
Specifies identifiers to indicate the return value of an assert dialog box.
Definition: assert_dialog_result.h:21
static void write(const object_t &message, const xtd::ustring &category)
Writes a category name and message to the trace listeners in the listeners collection.
Definition: debug.h:289
static void flush()
Flushes the output buffer and causes buffered data to write to the listeners collection.
Definition: debug.h:167
static void exit(int exit_code)
Terminates this process and returns an exit code to the operating system.
Definition: environment.h:342
Represents a collection of xtd::diagnostics::trace_listener.
Definition: trace_listener_collection.h:24
Provides information about a xtd::diagnostics::stack_frame, which represents a function call on the c...
Definition: stack_frame.h:34
Contains xtd::diagnostics::trace_listener_collection class.
The assert dialog return value is Retry (usually sent from a button labeled Retry).
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:330
static void write_line(const xtd::ustring &message)
Writes a message followed by a line terminator to the trace listeners in the listeners collection...
Definition: debug.h:361
static void fail(const xtd::ustring &message, const xtd::ustring &detail_message)
Emits an error message and a detailed error message.
Definition: debug.h:160
static void write_line_if(bool condition, const object_t &message, const xtd::ustring &category)
Writes a category name and message followed by a line terminator to the trace listeners in the Listen...
Definition: debug.h:435
static void write_line(const xtd::ustring &format, args_t &&... args)
Writes a formatted string followed by a line terminator to the trace listeners in the listeners colle...
Definition: debug.h:393
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:371
static void write_line(const object_t &message, const xtd::ustring &category)
Writes a category name and message followed by a line terminator to the trace listeners in the listen...
Definition: debug.h:383
Provides a set of methods and properties that help you debug the execution of your code...
Definition: trace.h:36
Provides a set of methods and properties that help you debug the execution of your code...
Definition: debug.h:50
static void write(const xtd::ustring &message)
Writes a message to the trace listeners in the listeners collection.
Definition: debug.h:267
static void print(const xtd::ustring &message)
Writes a message followed by a line terminator to the trace listeners in the listeners collection...
Definition: debug.h:179
static void trace_information(const xtd::ustring &message)
Writes an informational message to the trace listeners in the listeners collection using the specifie...
Definition: debug.h:225
static void trace_warning(const xtd::ustring &message, const objects_t &... args)
Writes a warning message to the trace listeners in the listeners collection using the specified array...
Definition: debug.h:254
static void write(const object_t &message)
Writes a message to the trace listeners in the listeners collection.
Definition: debug.h:277
Contains xtd::diagnostics::assert_dialog_result enum class.
static void write_line()
Writes a line terminator to the trace listeners in the listeners collection.
Definition: debug.h:352
static void write_line_if(bool condition, const xtd::ustring &message)
Writes a message followed by a line terminator to the trace listeners in the Listeners collection if ...
Definition: debug.h:412
static void trace_information(const xtd::ustring &message, const objects_t &... args)
Writes an informational message to the trace listeners in the listeners collection using the specifie...
Definition: debug.h:235
trace_event_type
Identifies the type of event that has caused the trace.
Definition: trace_event_type.h:21