7#include "../add_last_arg_to_command.h"
8#include "../core_export.h"
9#include "../environment.h"
11#include "../ustring.h"
26 namespace diagnostics {
78 static
void auto_flush(
bool auto_flush) noexcept;
83 static
uint32 indent_level() noexcept;
87 static
void indent_level(
uint32 indent_level) noexcept;
92 static
uint32 indent_size() noexcept;
96 static
void indent_size(
uint32 indent_size) noexcept;
115 static
bool show_assert_dialog() noexcept;
122 static
void show_assert_dialog(
bool show_assert_dialog) noexcept;
127 static
bool use_global_lock() noexcept;
131 static
void use_global_lock(
bool use_global_lock) noexcept;
142 static
void cassert(
bool condition);
146 static
void cassert(
bool condition, const
xtd::
ustring& message);
173 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
183 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
184 fail__(message, detail_message);
190 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
202 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
203 write_line_(message);
210 template<
typename ...args_t>
212 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
217 template<
typename ...args_t>
218 static void print(
const char* format, args_t&& ... args) {
219 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
229 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
230 trace_event_(trace_event_type::error, message);
237 template<
typename ...objects_t>
239 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
248 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
249 trace_event_(trace_event_type::information, message);
256 template<
typename ...objects_t>
258 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
267 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
268 trace_event_(trace_event_type::warning, message);
275 template<
typename ...objects_t>
277 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
290 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
298 template<
typename object_t>
299 static void write(
const object_t& message) {
300 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
310 template<
typename object_t>
312 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
321 template<
typename ...args_t>
323 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
324 write_(ustring::format(format, args...));
328 template<
typename ...args_t>
329 static void write(
const char* format, args_t&& ... args) {
330 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
331 write_(ustring::format(format, args...));
342 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
343 if (condition) write_(message);
346 template<
typename object_t>
352 static void write_if(
bool condition,
const object_t& message) {
353 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
363 template<
typename object_t>
365 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
375 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
384 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
385 write_line_(message);
392 template<
typename object_t>
394 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
404 template<
typename object_t>
406 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
414 template<
typename ...args_t>
416 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
417 write_line_(ustring::format(format, args...));
421 template<
typename ...args_t>
422 static void write_line(
const char* format, args_t&& ... args) {
423 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
424 write_line_(ustring::format(format, args...));
435 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
436 if (condition) write_line_(message);
444 template<
typename object_t>
446 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
447 if (condition) write_line_(message);
456 template<
typename object_t>
458 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
459 if (condition) write_line_(message, category);
464 static inline bool __should_aborted__(
bool condition) {
return __should_aborted__(condition,
"",
csf_);}
465 static inline bool __should_aborted__(
bool condition,
const xtd::ustring& message) {
return __should_aborted__(condition, message,
csf_);}
466 static inline bool __should_aborted__(
bool condition,
const xtd::diagnostics::stack_frame& stack_frame) {
return __should_aborted__(condition,
"", stack_frame);}
468 static inline bool __should_aborted__(
bool condition,
const xtd::ustring& message,
const xtd::ustring& detail_message) {
return __should_aborted__(condition, message, detail_message,
csf_);}
470 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
471 auto result = xtd::diagnostics::debug::assert_dialog(condition, message, detail_message, stack_frame);
485 static bool internal_show_assert_dialog() noexcept;
486 static
void fail__(const
xtd::ustring& message);
487 static
void fail__(const
xtd::ustring& message, const
xtd::ustring& detail_message);
488 static
void flush_();
489 static
void trace_event_(trace_event_type trace_event_type, const
xtd::ustring& message);
490 static
void write_(const
xtd::ustring& message);
491 static
void write_(const
xtd::ustring& message, const
xtd::ustring& category);
492 static
void write_line_(const
xtd::ustring& message);
493 static
void write_line_(const
xtd::ustring& message, const
xtd::ustring& category);
495 inline static
bool auto_flush_ = false;
496 inline static uint32 indent_level_ = 0;
497 inline static uint32 indent_size_ = 4;
498 static listener_collection& listeners_;
499 static
xtd::ustring source_name_;
525#define cassert_(...) \
526 add_last_arg_to_command_(cassert, (csf_), __VA_ARGS__)
Contains xtd::diagnostics::assert_dialog_result enum class.
Provides a set of methods and properties that help you debug the execution of your code....
Definition debug.h:57
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:341
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:405
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:247
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:434
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:457
static void indent() noexcept
Increases the current indent_level by one.
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:211
static void write_line()
Writes a line terminator to the trace listeners in the listeners collection.
Definition debug.h:374
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:228
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:257
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:445
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:393
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:322
static bool auto_flush() noexcept
Gets whether xtd::diagnostics::debug::flush should be called on the xtd::diagnostics::debug::Listener...
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:276
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:364
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:266
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:352
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:415
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:311
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:383
static void write(const object_t &message)
Writes a message to the trace listeners in the listeners collection.
Definition debug.h:299
static void flush()
Flushes the output buffer and causes buffered data to write to the listeners collection.
Definition debug.h:189
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:238
static void unindent() noexcept
Decreases the current indent_level by one.
static void fail(const xtd::ustring &message, const xtd::ustring &detail_message)
Emits an error message and a detailed error message.
Definition debug.h:182
Provides the default output methods and behavior for tracing.
Definition default_trace_listener.h:31
Provides information about a xtd::diagnostics::stack_frame, which represents a function call on the c...
Definition stack_frame.h:37
Represents a collection of xtd::diagnostics::trace_listener.
Definition trace_listener_collection.h:27
static void exit()
Terminates this process and returns an exit code to the operating system.
Represents text as a sequence of UTF-8 code units.
Definition ustring.h:47
Represents the version number of an assembly, operating system, or the xtd. This class cannot be inhe...
Definition version.h:110
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
uint_least32_t uint32
Represents a 32-bit unsigned integer.
Definition types.h:241
assert_dialog_result
Specifies identifiers to indicate the return value of an assert dialog box.
Definition assert_dialog_result.h:23
@ 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.