xtd_c - Reference Guide 0.2.0
trace_listener.h File Reference
#include "../object.h"
#include "trace_options.h"

Definition

Contains trace_listener definitions.

Go to the source code of this file.

Data Structures

struct  xtd_diagnostics_trace_listener
 Defines the trace_listener object. More...
 

Converter

#define XTD_DIAGNOSTICS_TRACE_LISTENER(object)   (XTD_TYPE_CAST(object, XTD_DIAGNOSTICS_TRACE_LISTENER_TYPE, xtd_diagnostics_trace_listener))
 Convert an xtd object to trace_listener object. More...
 

Properties

uint32_t xtd_diagnostics_trace_listener_get_indent_level (xtd_diagnostics_trace_listener *listener)
 Gets the indent level. More...
 
void xtd_diagnostics_trace_listener_set_indent_level (xtd_diagnostics_trace_listener *listener, uint32_t indent_level)
 Sets the indent level. More...
 
uint32_t xtd_diagnostics_trace_listener_get_indent_size (xtd_diagnostics_trace_listener *listener)
 Gets the number of spaces in an indent. More...
 
void xtd_diagnostics_trace_listener_set_indent_size (xtd_diagnostics_trace_listener *listener, uint32_t indent_size)
 Sets the number of spaces in an indent. More...
 
bool xtd_diagnostics_trace_listener_is_thread_safe (xtd_diagnostics_trace_listener *listener)
 Gets a value indicating whether the trace listener is thread safe. More...
 
const char * xtd_diagnostics_trace_listener_get_name (xtd_diagnostics_trace_listener *listener)
 Gets or sets a name for this TraceListener. More...
 
void xtd_diagnostics_trace_listener_set_name (xtd_diagnostics_trace_listener *listener, const char *name)
 Sets a name for this TraceListener. More...
 
xtd_diagnostics_trace_options xtd_diagnostics_trace_listener_get_trace_output_options (xtd_diagnostics_trace_listener *listener)
 Gets the trace output options. More...
 
void xtd_diagnostics_trace_listener_set_trace_output_options (xtd_diagnostics_trace_listener *listener, xtd_diagnostics_trace_options trace_output_options)
 Sets the trace output options. More...
 

Function Documentation

◆ xtd_diagnostics_trace_listener_get_indent_level()

uint32_t xtd_diagnostics_trace_listener_get_indent_level ( xtd_diagnostics_trace_listener listener)

Gets the indent level.

Returns
uint32_t The indent level. The default is zero.
Remarks
The IndentLevel property represents the number of times that the indent specified by the IndentSize property is applied. This property is stored on per-thread/per-request basis.

◆ xtd_diagnostics_trace_listener_get_indent_size()

uint32_t xtd_diagnostics_trace_listener_get_indent_size ( xtd_diagnostics_trace_listener listener)

Gets the number of spaces in an indent.

Returns
uint32_t The number of spaces in an indent. The default is four spaces.
Remarks
The property is stored on per-thread/per-request basis.

◆ xtd_diagnostics_trace_listener_get_name()

const char* xtd_diagnostics_trace_listener_get_name ( xtd_diagnostics_trace_listener listener)

Gets or sets a name for this TraceListener.

Returns
string A name for this TraceListener. The default is an empty string ("").
Remarks
The name can be used to organize and access listeners in a TraceListenerCollection collection.

◆ xtd_diagnostics_trace_listener_get_trace_output_options()

xtd_diagnostics_trace_options xtd_diagnostics_trace_listener_get_trace_output_options ( xtd_diagnostics_trace_listener listener)

Gets the trace output options.

Returns
trace_options A bitwise combination of the enumeration values. The default is None.
Remarks
The TraceOutputOptions property determines the optional content of trace output. The property can be set in the configuration file or programmatically during execution to include additional data specifically for a section of code. For example, you can set the TraceOutputOptions property for the console trace listener to TraceOptions.Callstack to add call stack information to the trace output.
The TraceOptions enumeration is not used by the following classes and methods: The EventLogTraceListener class, because it can cause a large volume of data to be written to the log. The Write and WriteLine methods of the ConsoleTraceListener, DefaultTraceListener, and TextWriterTraceListener classes. The Write and WriteLine methods of the TraceListener class when they are not overridden in a derived class.

◆ xtd_diagnostics_trace_listener_is_thread_safe()

bool xtd_diagnostics_trace_listener_is_thread_safe ( xtd_diagnostics_trace_listener listener)

Gets a value indicating whether the trace listener is thread safe.

Returns
bool true if the trace listener is thread safe; otherwise, false. The default is false.
Remarks
The value of IsThreadSafe is used to determine whether to use a global lock when writing to the listener. If the value of IsThreadSafe is false, the global lock is used regardless of the value of UseGlobalLock. The global lock is not used only if the value of IsThreadSafe is true and the value of UseGlobalLock is false. The default behavior is to use the global lock whenever writing to the listener.

◆ xtd_diagnostics_trace_listener_set_indent_level()

void xtd_diagnostics_trace_listener_set_indent_level ( xtd_diagnostics_trace_listener listener,
uint32_t  indent_level 
)

Sets the indent level.

Parameters
indent_levelThe indent level. The default is zero.
Remarks
The IndentLevel property represents the number of times that the indent specified by the IndentSize property is applied. This property is stored on per-thread/per-request basis.

◆ xtd_diagnostics_trace_listener_set_indent_size()

void xtd_diagnostics_trace_listener_set_indent_size ( xtd_diagnostics_trace_listener listener,
uint32_t  indent_size 
)

Sets the number of spaces in an indent.

Parameters
int32The number of spaces in an indent. The default is four spaces.
Remarks
The property is stored on per-thread/per-request basis.

◆ xtd_diagnostics_trace_listener_set_name()

void xtd_diagnostics_trace_listener_set_name ( xtd_diagnostics_trace_listener listener,
const char *  name 
)

Sets a name for this TraceListener.

Parameters
nameA name for this TraceListener. The default is an empty string ("").
Remarks
The name can be used to organize and access listeners in a TraceListenerCollection collection.

◆ xtd_diagnostics_trace_listener_set_trace_output_options()

void xtd_diagnostics_trace_listener_set_trace_output_options ( xtd_diagnostics_trace_listener listener,
xtd_diagnostics_trace_options  trace_output_options 
)

Sets the trace output options.

Parameters
trace_output_optionsA bitwise combination of the enumeration values. The default is None.
Remarks
The TraceOutputOptions property determines the optional content of trace output. The property can be set in the configuration file or programmatically during execution to include additional data specifically for a section of code. For example, you can set the TraceOutputOptions property for the console trace listener to TraceOptions.Callstack to add call stack information to the trace output.
The TraceOptions enumeration is not used by the following classes and methods: The EventLogTraceListener class, because it can cause a large volume of data to be written to the log. The Write and WriteLine methods of the ConsoleTraceListener, DefaultTraceListener, and TextWriterTraceListener classes. The Write and WriteLine methods of the TraceListener class when they are not overridden in a derived class.