xtd 0.2.0
Loading...
Searching...
No Matches
xtd::diagnostics::ostream_trace_listener Class Reference
Inheritance diagram for xtd::diagnostics::ostream_trace_listener:
xtd::diagnostics::trace_listener xtd::abstract_object xtd::object xtd::diagnostics::console_trace_listener

Definition

Directs tracing or debugging output to a std::ostream, such as std::fstream, std::stream...

ostream_trace_listener(const std::ostream &ostream)
Initializes a new instance of the xtd::diagnostics::ostream_trace_listener class with a specified ost...
Provides the abstract base class for the listeners who monitor trace and debug output.
Definition trace_listener.hpp:42
#define core_export_
Define shared library export.
Definition core_export.hpp:13
Inheritance
xtd::objectxtd::abstract_objectxtd::diagnostics::trace_listenerxtd::diagnostics::ostream_trace_listener
Header
#include <xtd/diagnostics/ostream_trace_listener>
Namespace
xtd::diagnostics
Library
xtd.core

Public Constructors

 ostream_trace_listener (const std::ostream &ostream)
 Initializes a new instance of the xtd::diagnostics::ostream_trace_listener class with a specified ostream.
 

Public Properties

virtual const std::ostream & ostream () const
 Gets the underlying stream.
 
virtual void ostream (const std::ostream &ostream)
 Sets the underlying stream.
 

Public Methods

void close () override
 When overridden in a derived class, closes the output stream so it no longer receives tracing or debugging output.
 
void flush () override
 When overridden in a derived class, flushes the output buffer.
 
void write (const xtd::string &message) override
 Writes the message to the listener you create when you implement the trace_listener class.
 
void write_line (const xtd::string &message) override
 Writes the message to the listener you create when you implement the trace_listener class followed by a line terminator.followed by a line terminator.
 
template<class object>
void write (const object &o)
 Writes the value of the object's ToString method to the listener you create when you implement the TraceListener class.
 
template<class object>
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 you implement the TraceListener class.
 
template<class object>
void write_line (const object &o)
 Writes the value of the object's ToString method to the listener you create when you implement the TraceListener class.
 
template<class object>
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 you implement the TraceListener class.
 

Additional Inherited Members

 trace_listener ()=default
 Initializes a new instance of the trace_listener class.
 
 trace_listener (const xtd::string &name)
 Initializes a new instance of the trace_listener class using the specified name as the listener.
 
uint32 indent_level () const noexcept
 Gets the indent level.
 
void indent_level (uint32 indent_level) noexcept
 Sets the indent level.
 
uint32 indent_size () const noexcept
 Gets the number of spaces in an indent.
 
void indent_size (uint32 indent_size) noexcept
 Sets the number of spaces in an indent.
 
virtual bool is_thread_safe () const noexcept
 Gets a value indicating whether the trace listener is thread safe.
 
const xtd::stringname () const noexcept
 Gets or sets a name for this TraceListener.
 
void name (const xtd::string &name) noexcept
 Sets a name for this TraceListener.
 
trace_options trace_output_options () const noexcept
 Gets the trace output options.
 
void trace_output_options (trace_options trace_output_options) noexcept
 Sets the trace output options.
 
virtual void fail (const xtd::string &message)
 Emits an error message to the listener you create when you implement the TraceListener class.
 
virtual void fail (const xtd::string &message, const xtd::string &detail_message)
 Emits the specified error message.
 
template<class objelassct>
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.
 
template<class objelassct>
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.
 
template<class ... objects>
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 output.
 
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.
 
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.
 
template<class ... objects>
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 output.
 
template<class activity_id_type>
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 listener specific output.
 
template<class object>
void write (const object &o)
 Writes the value of the object's ToString method to the listener you create when you implement the TraceListener class.
 
template<class object>
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 you implement the TraceListener class.
 
template<class object>
void write_line (const object &o)
 Writes the value of the object's ToString method to the listener you create when you implement the TraceListener class.
 
template<class object>
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 you implement the TraceListener class.
 
 object ()=default
 Create a new instance of the ultimate base class object.
 
virtual bool equals (const object &obj) const noexcept
 Determines whether the specified object is equal to the current object.
 
virtual xtd::size get_hash_code () const noexcept
 Serves as a hash function for a particular type.
 
virtual type_object get_type () const noexcept
 Gets the type of the current instance.
 
template<class object_t>
xtd::unique_ptr_object< object_t > memberwise_clone () const
 Creates a shallow copy of the current object.
 
virtual xtd::string to_string () const noexcept
 Returns a xtd::string that represents the current object.
 
template<class object_a_t, class object_b_t>
static bool equals (const object_a_t &object_a, const object_b_t &object_b) noexcept
 Determines whether the specified object instances are considered equal.
 
template<class object_a_t, class object_b_t>
static bool reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept
 Determines whether the specified object instances are the same instance.
 
bool need_indent () const noexcept
 Gets a value indicating whether to indent the output.
 
void need_indent (bool need_indent) noexcept
 Sets a value indicating whether to indent the output.
 
void thread_safe (bool thread_safe) noexcept
 Sets a value indicating whether the trace listener is thread safe.
 
virtual void write_indent ()
 Writes the indent to the listener you create when you implement this class, and resets the NeedIndent property to false.
 
 abstract_object ()=default
 Initializes a new instance of the xtd::abstract_object class.
 

Constructor & Destructor Documentation

◆ ostream_trace_listener()

xtd::diagnostics::ostream_trace_listener::ostream_trace_listener ( const std::ostream & ostream)
explicit

Initializes a new instance of the xtd::diagnostics::ostream_trace_listener class with a specified ostream.

Parameters
ostreamAn std::ostream that represents the stream the xtd::diagnostics::ostream_trace_listener writes to.
Remarks
This constructor initializes the name property to an empty string ("").

Member Function Documentation

◆ ostream() [1/2]

virtual const std::ostream & xtd::diagnostics::ostream_trace_listener::ostream ( ) const
virtual

Gets the underlying stream.

Returns
A std::ostream that represents the stream the ostream_trace_listener writes to.

◆ ostream() [2/2]

virtual void xtd::diagnostics::ostream_trace_listener::ostream ( const std::ostream & ostream)
virtual

Sets the underlying stream.

Parameters
ostreamA std::ostream that represents the stream the ostream_trace_listener writes to.

◆ close()

void xtd::diagnostics::ostream_trace_listener::close ( )
overridevirtual

When overridden in a derived class, closes the output stream so it no longer receives tracing or debugging output.

Remarks
Use this method when the output is going to a file, such as to the TextWriterTraceListener. After a call to this method, you must reinitialize the object.

Reimplemented from xtd::diagnostics::trace_listener.

◆ flush()

void xtd::diagnostics::ostream_trace_listener::flush ( )
inlineoverridevirtual

When overridden in a derived class, flushes the output buffer.

Reimplemented from xtd::diagnostics::trace_listener.

◆ write() [1/3]

void xtd::diagnostics::ostream_trace_listener::write ( const xtd::string & message)
inlineoverridevirtual

Writes the message to the listener you create when you implement the trace_listener class.

Parameters
messageA string you want to write.

Implements xtd::diagnostics::trace_listener.

◆ write_line() [1/3]

void xtd::diagnostics::ostream_trace_listener::write_line ( const xtd::string & message)
inlineoverridevirtual

Writes the message to the listener you create when you implement the trace_listener class followed by a line terminator.followed by a line terminator.

Parameters
messageA string you want to write.

Implements xtd::diagnostics::trace_listener.

◆ write() [2/3]

template<class object>
void xtd::diagnostics::trace_listener::write ( const object & o)
inline

Writes the value of the object's ToString method to the listener you create when you implement the TraceListener class.

Parameters
oAn Object whose fully qualified class name you want to write.

◆ write() [3/3]

template<class object>
void xtd::diagnostics::trace_listener::write ( const object & o,
const xtd::string & category )
inline

Writes a category name and the value of the object's ToString method to the listener you create when you implement the TraceListener class.

Parameters
oAn Object whose fully qualified class name you want to write.
categoryA category name used to organize the output.

◆ write_line() [2/3]

template<class object>
void xtd::diagnostics::trace_listener::write_line ( const object & o)
inline

Writes the value of the object's ToString method to the listener you create when you implement the TraceListener class.

Parameters
oAn Object whose fully qualified class name you want to write.

◆ write_line() [3/3]

template<class object>
void xtd::diagnostics::trace_listener::write_line ( const object & o,
const xtd::string & category )
inline

Writes a category name and the value of the object's ToString method to the listener you create when you implement the TraceListener class.

Parameters
oAn Object whose fully qualified class name you want to write.
categoryA category name used to organize the output.

The documentation for this class was generated from the following file: