xtd 0.2.0
Loading...
Searching...
No Matches
console_trace_listener.cpp

Shows how to use xtd::diagnostics::console_trace_listener class.

#define DEBUG // Force debug mode even if example is builded in release.
#include <xtd/xtd>
auto main() -> int {
diagnostics::debug::listeners({new_ptr<diagnostics::console_trace_listener>()});
diagnostics::debug::write_line("Begin");
diagnostics::debug::indent();
for (auto step = 1; step <= 10; step++) {
diagnostics::debug::write_line("working step {}...", step);
thread::sleep(300_ms);
}
diagnostics::debug::unindent();
diagnostics::debug::write_line("End");
}
// This code produces the following output :
//
// Begin
// working step 1...
// working step 2...
// working step 3...
// working step 4...
// working step 5...
// working step 6...
// working step 7...
// working step 8...
// working step 9...
// working step 10...
// End