130 virtual
void fail(const
xtd::
string& message) {
131 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
132 write_line(xtd::string::format(
"Fail: {}", message));
141 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
142 write_line(xtd::string::format(
"Fail: {} {}", message, detail_message));
157 template<
class objelassct>
159 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
160 write_line(xtd::string::format(
"{} {}: {} : {}", source, event_type,
id,
data));
161 write_event_cache(event_cache);
173 template<
class objelassct>
175 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
176 write_line(xtd::string::format(
"{} {}: {} : {}", source, event_type,
id, xtd::string::join(
", ",
data)));
177 write_event_cache(event_cache);
189 template<
class ...objects>
191 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
192 write_line(xtd::string::format(
"{} {}: {} : {}", source, event_type,
id, xtd::string::join(
", ", {std::forward<objects>(
data)...})));
193 write_event_cache(event_cache);
205 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
206 write_line(xtd::string::format(
"{} {}: {}", source, event_type,
id));
207 write_event_cache(event_cache);
220 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
221 write_line(xtd::string::format(
"{} {}: {} : {}", source, event_type,
id, message));
222 write_event_cache(event_cache);
235 template<
class ...objects>
237 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
238 write_line(xtd::string::format(
"{} {}: {} : {}", source, event_type,
id, xtd::string::format(
format, args...)));
239 write_event_cache(event_cache);
252 template<
class activity_
id_type>
254 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
255 write_line(xtd::string::format(
"{} transfer: {} : {}, related_activity_id={}", source,
id, message, related_activity_id));
256 write_event_cache(event_cache);
262 template <
class object>
264 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
265 write(xtd::string::format(
"{}",
o));
272 template <
class object>
274 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
275 write(xtd::string::format(
"{} : {}",
o, category));
285 template <
class object>
287 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
295 template <
class object>
297 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
298 write_line(xtd::string::format(
"{} : {}",
o, category));
308 template <
class object>
310 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
339 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
340 need_indent_ =
false;
341 for (
uint32 i = 0;
i < indent_level_; ++
i)
352 bool is_thread_safe_ =
false;
354 bool need_indent_ =
true;
Contains xtd::abstract_object class.
Contains xtd::array class.
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition array.hpp:61
Provides trace event data specific to a thread and a process.
Definition trace_event_cache.hpp:29
void thread_safe(bool thread_safe) noexcept
Sets a value indicating whether the trace listener is thread safe.
virtual void flush()
When overridden in a derived class, flushes the output buffer.
Definition trace_listener.hpp:147
trace_options trace_output_options() const noexcept
Gets the trace output options.
virtual void trace_event(const xtd::diagnostics::trace_event_cache &event_cache, const xtd::string &source, const xtd::diagnostics::trace_event_type &event_type, int32 id)
Writes trace and event information to the listener specific output.
Definition trace_listener.hpp:204
void trace_data(const xtd::diagnostics::trace_event_cache &event_cache, const xtd::string &source, const xtd::diagnostics::trace_event_type &event_type, int32 id, const object &data)
Writes trace information, a data object and event information to the listener specific output.
Definition trace_listener.hpp:158
virtual void trace_event(const xtd::diagnostics::trace_event_cache &event_cache, const xtd::string &source, const xtd::diagnostics::trace_event_type &event_type, int32 id, const xtd::string &message)
Writes trace information, a message, and event information to the listener specific output.
Definition trace_listener.hpp:219
const xtd::string & name() const noexcept
Gets or sets a name for this TraceListener.
void trace_event(const xtd::diagnostics::trace_event_cache &event_cache, const xtd::string &source, const xtd::diagnostics::trace_event_type &event_type, int32 id, const xtd::string &format, const objects &... args)
Writes trace information, a formatted array of objects and event information to the listener specific...
Definition trace_listener.hpp:236
trace_listener(const xtd::string &name)
Initializes a new instance of the trace_listener class using the specified name as the listener.
virtual bool is_thread_safe() const noexcept
Gets a value indicating whether the trace listener is thread safe.
virtual void close()
When overridden in a derived class, closes the output stream so it no longer receives tracing or debu...
bool need_indent() const noexcept
Gets a value indicating whether to indent the output.
uint32 indent_size() const noexcept
Gets the number of spaces in an indent.
virtual void write(const xtd::string &message)=0
Writes the message to the listener you create when you implement the trace_listener class.
trace_listener()=default
Initializes a new instance of the trace_listener class.
void write(const object &o, const xtd::string &category)
Writes a category name and the value of the object's ToString method to the listener you create when ...
Definition trace_listener.hpp:273
void trace_data(const xtd::diagnostics::trace_event_cache &event_cache, const xtd::string &source, const xtd::diagnostics::trace_event_type &event_type, int32 id, objects &&... data)
Writes trace information, an array of data objects and event information to the listener specific out...
Definition trace_listener.hpp:190
virtual void fail(const xtd::string &message)
Emits an error message to the listener you create when you implement the TraceListener class.
Definition trace_listener.hpp:130
virtual void write_indent()
Writes the indent to the listener you create when you implement this class, and resets the NeedIndent...
Definition trace_listener.hpp:338
virtual void fail(const xtd::string &message, const xtd::string &detail_message)
Emits the specified error message.
Definition trace_listener.hpp:140
void write_line(const object &o)
Writes the value of the object's ToString method to the listener you create when you implement the Tr...
Definition trace_listener.hpp:286
virtual void write_line(const xtd::string &message)=0
Writes the message to the listener you create when you implement the trace_listener class followed by...
uint32 indent_level() const noexcept
Gets the indent level.
void write(const object &o)
Writes the value of the object's ToString method to the listener you create when you implement the Tr...
Definition trace_listener.hpp:263
void trace_transfer(const xtd::diagnostics::trace_event_cache &event_cache, const xtd::string &source, int32 id, const xtd::string &message, const activity_id_type &related_activity_id)
Writes trace information, a message, a related activity identity and event information to the listene...
Definition trace_listener.hpp:253
void trace_data(const xtd::diagnostics::trace_event_cache &event_cache, const xtd::string &source, const xtd::diagnostics::trace_event_type &event_type, int32 id, const xtd::array< object > &data)
Writes trace information, a data object and event information to the listener specific output.
Definition trace_listener.hpp:174
void write_line(const object &o, const xtd::string &category)
Writes a category name and the value of the object's ToString method to the listener you create when ...
Definition trace_listener.hpp:296
trace_options
Specifies trace data options to be written to the trace output.
Definition trace_options.hpp:25
@ none
Do not write any elements.
Definition trace_options.hpp:27
#define core_export_
Define shared library export.
Definition core_export.hpp:13
xtd::basic_string< char > string
Represents text as a sequence of UTF-8 code units.
Definition __string_definitions.hpp:43
int32_t int32
Represents a 32-bit signed integer.
Definition int32.hpp:23
uint32_t uint32
Represents a 32-bit unsigned integer.
Definition uint32.hpp:23
trace_event_type
Identifies the type of event that has caused the trace.
Definition trace_event_type.hpp:25
@ i
The I key.
Definition console_key.hpp:104
@ o
The O key.
Definition console_key.hpp:116
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 abstract_object.hpp:8
constexpr const_pointer data() const noexcept
Gets direct access to the underlying contiguous storage.
Definition read_only_span.hpp:201
Contains xtd::string alias.
Contains xtd::diagnostics::trace_event_cache class.
Contains xtd::diagnostics::trace_event_type enum class.
Contains xtd::diagnostics::trace_options enum class.