PostSharp 6.10 / / Post­Sharp Documentation / API Reference / Post­Sharp.​Patterns.​Diagnostics.​Custom Namespace / Log­Level­Source Class

LogLevelSource Class

A facade to a LogSource constrained to a specific LogLevel. Instances of the LogLevelSource class are exposed as properties of the LogSource class, e.g. Debug or Error.
Inheritance Hierarchy

Namespace:  PostSharp.Patterns.Diagnostics.Custom
Assembly:  PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: (
public sealed class LogLevelSource

The LogLevelSource type exposes the following members.

Public propertyEnabledOrNull
Returns the current LogLevelSource, or null if logging is not enabled for the current instance. This property allows to write conditional logging using the ?. operator.
Public propertyIsEnabled
Determines whether logging is enabled for the current Level.
Public propertyLevel
Gets the LogLevel to which the current LogLevelSource is constrained.
Public methodLogActivity<TDescription>(TDescription, Action, OpenActivityOptions)
Executes an Action and logs its execution.
Public methodLogActivity<TDescription, TResult>(TDescription, Func<TResult>, OpenActivityOptions)
Executes a Func<TResult> and logs its execution.
Public methodLogActivityAsync<TDescription>(TDescription, Func<Task>, OpenActivityOptions)
Executes an asynchronous void delegate and logs its execution.
Public methodLogActivityAsync<TDescription, TResult>(TDescription, Func<Task<TResult>>, OpenActivityOptions)
Executes an asynchronous non-void delegate and logs its execution.
Public methodOpenActivity<T>
Opens an activity.
Public methodWrite<T>(T, WriteMessageOptions)
Writes a message.
Public methodWrite<T>(T, Exception, WriteMessageOptions)
Writes a message and specifies an Exception.
See Also