Volume Control
Application-specific hotkeys for Windows
Loading...
Searching...
No Matches
VolumeControl.Log.AsyncLogWriter Class Referencesealed

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 .
 
bool FilterEventType (EventType eventType)
 Checks if messages with the specified eventType are shown in the log.
Parameters
eventTypeAn EventType to check.
Returns
true when the eventType is shown; otherwise false.

 
void ResetEndpoint ()
 Resets the endpoint to its default state by calling IEndpointWriter.Reset.
 
void ResetEndpoint (string firstLine)
 Resets the endpoint to its default state by calling IEndpointWriter.Reset, and writes the specified firstLine .
 
bool LogMessage (LogMessage logMessage)
 Writes the specified logMessage to the log, if its event type is enabled by the filter.When IsAsyncEnabled is true, the message is written asynchronously; otherwise, the message is written synchronously and the caller will be blocked until the message has been written.
 
bool Trace (params object?[] lines)
 
bool Trace (LogMessage logMessage)
 Queues writing an EventType.TRACE log message.
Parameters
logMessageA Log.LogMessage instance to write.

 
bool Debug (params object?[] lines)
 Queues writing an EventType.DEBUG message with the specified lines .
Parameters
linesAny number of objects. Each object will be written on a new line. null objects and blank strings are skipped.

 
bool Debug (LogMessage logMessage)
 Queues writing an EventType.DEBUG log message.
Parameters
logMessageA Log.LogMessage instance to write.

 
bool Info (params object?[] lines)
 Queues writing an EventType.INFO message with the specified lines .
Parameters
linesAny number of objects. Each object will be written on a new line. null objects and blank strings are skipped.

 
bool Info (LogMessage logMessage)
 Queues writing an EventType.INFO log message.
Parameters
logMessageA Log.LogMessage instance to write.

 
bool Warning (params object?[] lines)
 Queues writing an EventType.WARN message with the specified lines .
Parameters
linesAny number of objects. Each object will be written on a new line. null objects and blank strings are skipped.

 
bool Warning (LogMessage logMessage)
 Queues writing an EventType.WARN log message.
Parameters
logMessageA Log.LogMessage instance to write.

 
bool Error (params object?[] lines)
 Queues writing an EventType.ERROR message with the specified lines .
Parameters
linesAny number of objects. Each object will be written on a new line. null objects and blank strings are skipped.

 
bool Error (LogMessage logMessage)
 Queues writing an EventType.ERROR log message.
Parameters
logMessageA Log.LogMessage instance to write.

 
bool Fatal (params object?[] lines)
 Queues writing an EventType.FATAL message with the specified lines .
Parameters
linesAny number of objects. Each object will be written on a new line. null objects and blank strings are skipped.

 
bool Fatal (LogMessage logMessage)
 Queues writing an EventType.FATAL log message.
Parameters
logMessageA Log.LogMessage instance to write.

 
bool Critical (params object?[] lines)
 Queues writing an EventType.CRITICAL message with the specified lines .
Parameters
linesAny number of objects. Each object will be written on a new line. null objects and blank strings are skipped.

 
bool Critical (LogMessage logMessage)
 Queues writing an EventType.CRITICAL log message.
Parameters
logMessageA Log.LogMessage instance to write.

 
bool Blank (params object?[] lines)
 Queues writing an EventType.NONE message with the specified lines .This produces a message with no event type header, but a timestamp is still shown.
 
bool Blank (LogMessage logMessage)
 Queues writing an EventType.NONE log message.This produces a message with no event type header, but a timestamp is still shown.
 
void DisableAsyncNoFlush ()
 Sets the IsAsyncEnabled property to false without flushing the queue.
 
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.
 
bool Flush (int timeoutMs)
 Blocks the caller until the background thread has finished processing the queue, or until the specified timeout has elapsed.
 
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.
 
void Dispose ()
 Terminates the background thread. Does not flush the queue.
 

Static Public Attributes

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

Properties

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

Events

PropertyChangedEventHandler? PropertyChanged
 

Additional Inherited Members

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

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

◆ Blank() [1/2]

bool VolumeControl.Log.AsyncLogWriter.Blank ( LogMessage  logMessage)

Queues writing an EventType.NONE log message.This produces a message with no event type header, but a timestamp is still shown.

Implements VolumeControl.Log.Interfaces.ILogWriter.

◆ Blank() [2/2]

bool VolumeControl.Log.AsyncLogWriter.Blank ( params object?[]  lines)

Queues writing an EventType.NONE message with the specified lines .This produces a message with no event type header, but a timestamp is still shown.

Implements VolumeControl.Log.Interfaces.ILogWriter.

◆ Critical() [1/2]

bool VolumeControl.Log.AsyncLogWriter.Critical ( LogMessage  logMessage)

Queues writing an EventType.CRITICAL log message.

Parameters
logMessageA Log.LogMessage instance to write.

Implements VolumeControl.Log.Interfaces.ILogWriter.

◆ Critical() [2/2]

bool VolumeControl.Log.AsyncLogWriter.Critical ( params object?[]  lines)

Queues writing an EventType.CRITICAL message with the specified lines .

Parameters
linesAny number of objects. Each object will be written on a new line. null objects and blank strings are skipped.

Implements VolumeControl.Log.Interfaces.ILogWriter.

◆ Debug() [1/2]

bool VolumeControl.Log.AsyncLogWriter.Debug ( LogMessage  logMessage)

Queues writing an EventType.DEBUG log message.

Parameters
logMessageA Log.LogMessage instance to write.

Implements VolumeControl.Log.Interfaces.ILogWriter.

◆ Debug() [2/2]

bool VolumeControl.Log.AsyncLogWriter.Debug ( params object?[]  lines)

Queues writing an EventType.DEBUG message with the specified lines .

Parameters
linesAny number of objects. Each object will be written on a new line. null objects and blank strings are skipped.

Implements VolumeControl.Log.Interfaces.ILogWriter.

◆ 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.

◆ Dispose()

new void VolumeControl.Log.AsyncLogWriter.Dispose ( )

◆ Error() [1/2]

bool VolumeControl.Log.AsyncLogWriter.Error ( LogMessage  logMessage)

Queues writing an EventType.ERROR log message.

Parameters
logMessageA Log.LogMessage instance to write.

Implements VolumeControl.Log.Interfaces.ILogWriter.

◆ Error() [2/2]

bool VolumeControl.Log.AsyncLogWriter.Error ( params object?[]  lines)

Queues writing an EventType.ERROR message with the specified lines .

Parameters
linesAny number of objects. Each object will be written on a new line. null objects and blank strings are skipped.

Implements VolumeControl.Log.Interfaces.ILogWriter.

Referenced by VolumeControl.SDK.Internal.Initializer.Initialize(), and VolumeControl.Core.Input.Actions.HotkeyActionInstance.Invoke().

Here is the caller graph for this function:

◆ Fatal() [1/2]

bool VolumeControl.Log.AsyncLogWriter.Fatal ( LogMessage  logMessage)

Queues writing an EventType.FATAL log message.

Parameters
logMessageA Log.LogMessage instance to write.

Implements VolumeControl.Log.Interfaces.ILogWriter.

◆ Fatal() [2/2]

bool VolumeControl.Log.AsyncLogWriter.Fatal ( params object?[]  lines)

Queues writing an EventType.FATAL message with the specified lines .

Parameters
linesAny number of objects. Each object will be written on a new line. null objects and blank strings are skipped.

Implements VolumeControl.Log.Interfaces.ILogWriter.

◆ FilterEventType()

bool VolumeControl.Log.AsyncLogWriter.FilterEventType ( EventType  eventType)

Checks if messages with the specified eventType are shown in the log.

Parameters
eventTypeAn EventType to check.
Returns
true when the eventType is shown; otherwise false.

Implements VolumeControl.Log.Interfaces.ILogWriter.

References VolumeControl.Log.AsyncLogWriter.AlwaysVisibleEventTypes, and VolumeControl.Log.AsyncLogWriter.EventTypeFilter.

Referenced by VolumeControl.CoreAudio.AudioDevice.Dispose(), VolumeControl.CoreAudio.AudioSession.Dispose(), VolumeControl.Core.Input.Actions.HotkeyActionInstance.Invoke(), and VolumeControl.Log.AsyncLogWriter.LogMessage().

Here is the caller graph for this function:

◆ Info() [1/2]

bool VolumeControl.Log.AsyncLogWriter.Info ( LogMessage  logMessage)

Queues writing an EventType.INFO log message.

Parameters
logMessageA Log.LogMessage instance to write.

Implements VolumeControl.Log.Interfaces.ILogWriter.

◆ Info() [2/2]

bool VolumeControl.Log.AsyncLogWriter.Info ( params object?[]  lines)

Queues writing an EventType.INFO message with the specified lines .

Parameters
linesAny number of objects. Each object will be written on a new line. null objects and blank strings are skipped.

Implements VolumeControl.Log.Interfaces.ILogWriter.

◆ LogMessage()

bool VolumeControl.Log.AsyncLogWriter.LogMessage ( LogMessage  logMessage)

Writes the specified logMessage to the log, if its event type is enabled by the filter.When IsAsyncEnabled is true, the message is written asynchronously; otherwise, the message is written synchronously and the caller will be blocked until the message has been written.

Implements VolumeControl.Log.Interfaces.ILogWriter.

References VolumeControl.Log.Helpers.ThreadedActionQueue.Enqueue(), VolumeControl.Log.LogMessage.EventType, VolumeControl.Log.AsyncLogWriter.FilterEventType(), and VolumeControl.Log.AsyncLogWriter.IsAsyncEnabled.

Here is the call graph for this function:

◆ 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.

◆ Trace()

bool VolumeControl.Log.AsyncLogWriter.Trace ( LogMessage  logMessage)

Queues writing an EventType.TRACE log message.

Parameters
logMessageA Log.LogMessage instance to write.

Implements VolumeControl.Log.Interfaces.ILogWriter.

◆ Warning() [1/2]

bool VolumeControl.Log.AsyncLogWriter.Warning ( LogMessage  logMessage)

Queues writing an EventType.WARN log message.

Parameters
logMessageA Log.LogMessage instance to write.

Implements VolumeControl.Log.Interfaces.ILogWriter.

◆ Warning() [2/2]

bool VolumeControl.Log.AsyncLogWriter.Warning ( params object?[]  lines)

Queues writing an EventType.WARN message with the specified lines .

Parameters
linesAny number of objects. Each object will be written on a new line. null objects and blank strings are skipped.

Implements VolumeControl.Log.Interfaces.ILogWriter.

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().

Event Documentation

◆ PropertyChanged

PropertyChangedEventHandler? VolumeControl.Log.AsyncLogWriter.PropertyChanged


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