C# Class GSF.Diagnostics.LogPublisher

A publisher of log messages.
InitialStackMessages and InitialStackTrace can be modified so messages that are generated with this instance will have this data appended to the log message. The user can either call one of the Publish overloads to lazily publish a message, or they can register a message with RegisterEvent so calling this message will incur little overhead. If registering an event, the user can check LogEventPublisher.HasSubscribers to determine if the log message can be skipped altogether. Registering events also allows the user to specify the auto-suppression algorithm and the depth of the stack trace that will be recorded on a message being raised.
Mostrar archivo Open project: GridProtectionAlliance/gsf Class Usage Examples

Public Properties

Property Type Description
InitialStackMessages LogStackMessages
InitialStackTrace LogStackTrace

Public Methods

Method Description
Publish ( MessageLevel level, MessageFlags flags, string eventName, string message = null, string details = null, Exception exception = null ) : void

Raises a log message with the provided data.

Publish ( MessageLevel level, string eventName, string message = null, string details = null, Exception exception = null ) : void

Raises a log message with the provided data.

RegisterEvent ( MessageLevel level, MessageFlags flags, string eventName ) : LogEventPublisher

Initializes an LogEventPublisher with the provided values.

RegisterEvent ( MessageLevel level, MessageFlags flags, string eventName, int stackTraceDepth, MessageRate messagesPerSecond, int burstLimit ) : LogEventPublisher

Initializes an LogEventPublisher with the provided values.

RegisterEvent ( MessageLevel level, string eventName ) : LogEventPublisher

Initializes an LogEventPublisher with the provided values.

RegisterEvent ( MessageLevel level, string eventName, int stackTraceDepth, MessageRate messagesPerSecond, int burstLimit ) : LogEventPublisher

Initializes an LogEventPublisher with the provided values.

ToString ( ) : string

Gets the full name of the type.

Private Methods

Method Description
InternalRegisterEvent ( LogMessageAttributes attributes, string eventName ) : LogEventPublisherInternal

Initializes an LogEventPublisher with a series of settings.

InternalRegisterEvent ( LogMessageAttributes attributes, string eventName, int stackTraceDepth, MessageRate messagesPerSecond, int burstLimit ) : LogEventPublisherInternal

Initializes an LogEventPublisher with a series of settings.

InternalRegisterNewEvent ( LogMessageAttributes attributes, string eventName, int stackTraceDepth, double messagesPerSecond, int burstLimit ) : LogEventPublisherInternal
LogPublisher ( LoggerInternal logger, LogPublisherInternal publisherInstance, MessageClass classification ) : System

Method Details

Publish() public method

Raises a log message with the provided data.
public Publish ( MessageLevel level, MessageFlags flags, string eventName, string message = null, string details = null, Exception exception = null ) : void
level MessageLevel the level of the message
flags MessageFlags associated flags
eventName string A short name about what this message is detailing. Typically this will be a few words.
message string A longer message than giving more specifics about the actual message. /// Typically, this will be up to 1 line of text.
details string A long text field with the details of the message.
exception System.Exception An exception object if one is provided.
return void

Publish() public method

Raises a log message with the provided data.
public Publish ( MessageLevel level, string eventName, string message = null, string details = null, Exception exception = null ) : void
level MessageLevel the level of the message
eventName string A short name about what this message is detailing. Typically this will be a few words.
message string A longer message than giving more specifics about the actual message. /// Typically, this will be up to 1 line of text.
details string A long text field with the details of the message.
exception System.Exception An exception object if one is provided.
return void

RegisterEvent() public method

Initializes an LogEventPublisher with the provided values.
public RegisterEvent ( MessageLevel level, MessageFlags flags, string eventName ) : LogEventPublisher
level MessageLevel the level of the message
flags MessageFlags associated flags
eventName string the name of the event.
return LogEventPublisher

RegisterEvent() public method

Initializes an LogEventPublisher with the provided values.
public RegisterEvent ( MessageLevel level, MessageFlags flags, string eventName, int stackTraceDepth, MessageRate messagesPerSecond, int burstLimit ) : LogEventPublisher
level MessageLevel the level of the message
flags MessageFlags associated flags
eventName string
stackTraceDepth int
messagesPerSecond MessageRate
burstLimit int
return LogEventPublisher

RegisterEvent() public method

Initializes an LogEventPublisher with the provided values.
public RegisterEvent ( MessageLevel level, string eventName ) : LogEventPublisher
level MessageLevel the level of the message and associated flags if any
eventName string the name of the event.
return LogEventPublisher

RegisterEvent() public method

Initializes an LogEventPublisher with the provided values.
public RegisterEvent ( MessageLevel level, string eventName, int stackTraceDepth, MessageRate messagesPerSecond, int burstLimit ) : LogEventPublisher
level MessageLevel the level of the message
eventName string
stackTraceDepth int
messagesPerSecond MessageRate
burstLimit int
return LogEventPublisher

ToString() public method

Gets the full name of the type.
public ToString ( ) : string
return string

Property Details

InitialStackMessages public_oe property

The stack messages that existed when this publisher was created. This can be modified by the user of this publisher. Any messages that get published by this class will automatically have this data added to the log message.
public LogStackMessages InitialStackMessages
return LogStackMessages

InitialStackTrace public_oe property

The stack trace that existed when this publisher was created. This can be modified by the user of this publisher. Any messages that get published by this class will automatically have this data added to the log message.
public LogStackTrace InitialStackTrace
return LogStackTrace