Volume Control
Application-specific hotkeys for Windows
VolumeControl.Log.AsyncLogWriter Class Reference

Asynchonously writes messages to the log endpoint. More...

Inheritance diagram for VolumeControl.Log.AsyncLogWriter:
Collaboration diagram for VolumeControl.Log.AsyncLogWriter:

Public Member Functions

 AsyncLogWriter (IEndpointWriter endpoint, EventType eventTypeFilter)
 Creates a new AsyncLogWriter instance with the specified endpoint and eventTypeFilter . More...
 
bool FilterEventType (EventType eventType)
 Checks if messages with the specified eventType are shown in the log.
 
void ResetEndpoint ()
 Resets the endpoint to its default state by calling IEndpointWriter.Reset. More...
 
void ResetEndpoint (string firstLine)
 Resets the endpoint to its default state by calling IEndpointWriter.Reset, and writes the specified firstLine . More...
 
bool LogMessage (LogMessage logMessage)
 Writes the specified logMessage to the log, if its event type is enabled by the filter.
 
bool Trace (params object?[] lines)
 
bool Trace (LogMessage logMessage)
 Queues writing an EventType.TRACE log message.
 
bool Debug (params object?[] lines)
 Queues writing an EventType.DEBUG message with the specified lines .
 
bool Debug (LogMessage logMessage)
 Queues writing an EventType.DEBUG log message.
 
bool Info (params object?[] lines)
 Queues writing an EventType.INFO message with the specified lines .
 
bool Info (LogMessage logMessage)
 Queues writing an EventType.INFO log message.
 
bool Warning (params object?[] lines)
 Queues writing an EventType.WARN message with the specified lines .
 
bool Warning (LogMessage logMessage)
 Queues writing an EventType.WARN log message.
 
bool Error (params object?[] lines)
 Queues writing an EventType.ERROR message with the specified lines .
 
bool Error (LogMessage logMessage)
 Queues writing an EventType.ERROR log message.
 
bool Fatal (params object?[] lines)
 Queues writing an EventType.FATAL message with the specified lines .
 
bool Fatal (LogMessage logMessage)
 Queues writing an EventType.FATAL log message.
 
bool Critical (params object?[] lines)
 Queues writing an EventType.CRITICAL message with the specified lines .
 
bool Critical (LogMessage logMessage)
 Queues writing an EventType.CRITICAL log message.
 
bool Blank (params object?[] lines)
 Queues writing an EventType.NONE message with the specified lines .
 
bool Blank (LogMessage logMessage)
 Queues writing an EventType.NONE log message.
 
void DisableAsyncNoFlush ()
 Sets the IsAsyncEnabled property to false without flushing the queue. More...
 
new void Dispose ()
 
- Public Member Functions inherited from VolumeControl.Log.Helpers.ThreadedActionQueue
void Flush ()
 Blocks the caller until the background thread has finished processing the queue. More...
 
bool Flush (int timeoutMs)
 Blocks the caller until the background thread has finished processing the queue, or until the specified timeout has elapsed. More...
 
bool Flush (int timeoutMs, bool exitContext)
 Blocks the caller until the background thread has finished processing the queue, or until the specified timeout has elapsed. More...
 
void Dispose ()
 Terminates the background thread. Does not flush the queue. More...
 

Static Public Attributes

const string DateTimeFormatString = "HH:mm:ss:fff"
 The string that defines the format of timestamps. More...
 
static readonly int TimestampLength
 Length of the timestamp segment of the line header. More...
 
static readonly int EventTypeLength
 Length of the event type segment of the line header. More...
 
static readonly string BlankLineHeader
 A blank string with the same length as a line header. More...
 
const EventType AlwaysVisibleEventTypes = EventType.FATAL | EventType.CRITICAL
 Event types that are always visible. EventType.NONE is implicitly included. More...
 

Properties

bool EndpointEnabled [get, set]
 Gets or sets whether the endpoint is enabled or not. More...
 
EventType EventTypeFilter [get, set]
 Gets or sets the event type filter that determines which message types are visible for this log writer instance. More...
 
bool IsAsyncEnabled [get, set]
 Gets or sets whether log messages are added to the queue to be written asynchronously, or written synchronously. More...
 

Events

PropertyChangedEventHandler? PropertyChanged
 

Additional Inherited Members

- Protected Member Functions inherited from VolumeControl.Log.Helpers.ThreadedActionQueue
 ThreadedActionQueue ()
 Instantiates a new ThreadedActionQueue instance. More...
 
void Enqueue (Action action)
 Adds the specified action to the queue. More...
 

Detailed Description

Asynchonously writes messages to the log endpoint.

Constructor & Destructor Documentation

◆ AsyncLogWriter()

VolumeControl.Log.AsyncLogWriter.AsyncLogWriter ( IEndpointWriter  endpoint,
EventType  eventTypeFilter 
)

Creates a new AsyncLogWriter instance with the specified endpoint and eventTypeFilter .

Parameters
endpointA log endpoint instance.
eventTypeFilterThe default event type filter.

Member Function Documentation

◆ DisableAsyncNoFlush()

void VolumeControl.Log.AsyncLogWriter.DisableAsyncNoFlush ( )

Sets the IsAsyncEnabled property to false without flushing the queue.

Queued messages will still be written, but any further messages will be written synchronously.

References VolumeControl.Log.AsyncLogWriter.IsAsyncEnabled.

◆ ResetEndpoint() [1/2]

void VolumeControl.Log.AsyncLogWriter.ResetEndpoint ( )

Resets the endpoint to its default state by calling IEndpointWriter.Reset.

Referenced by VolumeControl.Log.FLog.Initialize().

Here is the caller graph for this function:

◆ ResetEndpoint() [2/2]

void VolumeControl.Log.AsyncLogWriter.ResetEndpoint ( string  firstLine)

Resets the endpoint to its default state by calling IEndpointWriter.Reset, and writes the specified firstLine .

Parameters
firstLineThe first line to (synchronously) write to the log.

Member Data Documentation

◆ AlwaysVisibleEventTypes

const EventType VolumeControl.Log.AsyncLogWriter.AlwaysVisibleEventTypes = EventType.FATAL | EventType.CRITICAL
static

Event types that are always visible. EventType.NONE is implicitly included.

Referenced by VolumeControl.Log.AsyncLogWriter.FilterEventType().

◆ BlankLineHeader

readonly string VolumeControl.Log.AsyncLogWriter.BlankLineHeader
static

A blank string with the same length as a line header.

◆ DateTimeFormatString

const string VolumeControl.Log.AsyncLogWriter.DateTimeFormatString = "HH:mm:ss:fff"
static

The string that defines the format of timestamps.

◆ EventTypeLength

readonly int VolumeControl.Log.AsyncLogWriter.EventTypeLength
static

Length of the event type segment of the line header.

The event type segment comes after the timestamp.

◆ TimestampLength

readonly int VolumeControl.Log.AsyncLogWriter.TimestampLength
static

Length of the timestamp segment of the line header.

The timestamp segment comes before the event type.

Property Documentation

◆ EndpointEnabled

bool VolumeControl.Log.AsyncLogWriter.EndpointEnabled
getset

Gets or sets whether the endpoint is enabled or not.

◆ EventTypeFilter

EventType VolumeControl.Log.AsyncLogWriter.EventTypeFilter
getset

Gets or sets the event type filter that determines which message types are visible for this log writer instance.

Referenced by VolumeControl.Log.AsyncLogWriter.FilterEventType().

◆ IsAsyncEnabled

bool VolumeControl.Log.AsyncLogWriter.IsAsyncEnabled
getset

Gets or sets whether log messages are added to the queue to be written asynchronously, or written synchronously.

Returns
true when log messages are written asynchronously; otherwise false.

Referenced by VolumeControl.Log.AsyncLogWriter.DisableAsyncNoFlush(), and VolumeControl.Log.AsyncLogWriter.LogMessage().


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