C# Class GSF.Diagnostics.Logger

Manages the collection and reporting of logging information in a system.
Show file Open project: GridProtectionAlliance/gsf

Private Properties

Property Type Description
CurrentDomain_FirstChanceException void
CurrentDomain_UnhandledException void
DisposeStackMessage void
DisposeSuppressionFlags void
GrowStackDisposal void
Initialize void
Logger System
Shutdown void

Public Methods

Method Description
AppendStackMessages ( LogStackMessages messages ) : IDisposable

Temporarily appends data to the thread's stack so the data can be propagated to any messages generated on this thread. Be sure to call Dispose on the returned object to remove this from the stack.

AppendStackMessages ( string key, string value ) : IDisposable

Temporarily appends data to the thread's stack so the data can be propagated to any messages generated on this thread. Be sure to call Dispose on the returned object to remove this from the stack.

CreatePublisher ( Type type, MessageClass classification ) : LogPublisher

Looks up the type of the log source

CreateSubscriber ( VerboseLevel level = VerboseLevel.None ) : LogSubscriber

Creates a LogSubscriber

GetStackMessages ( ) : LogStackMessages

Searches the current stack frame for all related messages that will be published with this message.

OverrideSuppressLogMessages ( ) : IDisposable

Sets a flag that will allow log messages to be raised again. Remember to dispose of the callback to remove this override.

SuppressFirstChanceExceptionLogMessages ( ) : IDisposable

Sets a flag that will prevent First Chance Exception log messages from being raised on this thread. Remember to dispose of the callback to remove this suppression.

SuppressLogMessages ( ) : IDisposable

Sets a flag that will prevent log messages from being raised on this thread. Remember to dispose of the callback to remove this suppression.

SwallowException ( Exception ex, string message = null, string details = null, MessageFlags additionalFlags = MessageFlags.None ) : void

Logs that a first chance exception was intentionally not handled for the provided reason. In the LogFileViewer it will filter messages differently if it was indicated that they were swallowed.

Private Methods

Method Description
CurrentDomain_FirstChanceException ( object sender, System e ) : void
CurrentDomain_UnhandledException ( object sender, UnhandledExceptionEventArgs e ) : void
DisposeStackMessage ( int depth ) : void
DisposeSuppressionFlags ( int depth ) : void
GrowStackDisposal ( int desiredSize ) : void
Initialize ( ) : void

Ensures that the logger has been initialized.

Logger ( ) : System
Shutdown ( ) : void

Ensures that the logger is properly shutdown. This is called from ShutdownHandler.

Method Details

AppendStackMessages() public static method

Temporarily appends data to the thread's stack so the data can be propagated to any messages generated on this thread. Be sure to call Dispose on the returned object to remove this from the stack.
public static AppendStackMessages ( LogStackMessages messages ) : IDisposable
messages LogStackMessages
return IDisposable

AppendStackMessages() public static method

Temporarily appends data to the thread's stack so the data can be propagated to any messages generated on this thread. Be sure to call Dispose on the returned object to remove this from the stack.
public static AppendStackMessages ( string key, string value ) : IDisposable
key string
value string
return IDisposable

CreatePublisher() public static method

Looks up the type of the log source
public static CreatePublisher ( Type type, MessageClass classification ) : LogPublisher
type System.Type the type
classification MessageClass the classification of the type of messages that this publisher will raise.
return LogPublisher

CreateSubscriber() public static method

Creates a LogSubscriber
public static CreateSubscriber ( VerboseLevel level = VerboseLevel.None ) : LogSubscriber
level VerboseLevel
return LogSubscriber

GetStackMessages() public static method

Searches the current stack frame for all related messages that will be published with this message.
public static GetStackMessages ( ) : LogStackMessages
return LogStackMessages

OverrideSuppressLogMessages() public static method

Sets a flag that will allow log messages to be raised again. Remember to dispose of the callback to remove this override.
public static OverrideSuppressLogMessages ( ) : IDisposable
return IDisposable

SuppressFirstChanceExceptionLogMessages() public static method

Sets a flag that will prevent First Chance Exception log messages from being raised on this thread. Remember to dispose of the callback to remove this suppression.
public static SuppressFirstChanceExceptionLogMessages ( ) : IDisposable
return IDisposable

SuppressLogMessages() public static method

Sets a flag that will prevent log messages from being raised on this thread. Remember to dispose of the callback to remove this suppression.
public static SuppressLogMessages ( ) : IDisposable
return IDisposable

SwallowException() public static method

Logs that a first chance exception was intentionally not handled for the provided reason. In the LogFileViewer it will filter messages differently if it was indicated that they were swallowed.
public static SwallowException ( Exception ex, string message = null, string details = null, MessageFlags additionalFlags = MessageFlags.None ) : void
ex System.Exception the exception that was swallowed
message string message to include, such as a reason why it was swallowed.
details string additional details.
additionalFlags MessageFlags additional flags that can be set with this swallowed exception.
return void