PostSharpAPI ReferencePost­Sharp.​Patterns.​Diagnostics.​CustomLog­Level­Source
Open sandboxFocus

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
LogLevelSource
Namespace: PostSharp.Patterns.Diagnostics.Custom
Assembly: PostSharp.Patterns.Common.dll
Syntax
[RequirePostSharp("PostSharp.Patterns.Common.Weaver", "AddCallerInfoTask", AnyTypeReference = true)]
[RequirePostSharp]
public sealed class LogLevelSource : Object

Properties

Name Description
EnabledOrNull

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.

IsEnabled

Determines whether logging is enabled for the current Level.

Level

Gets the LogLevel to which the current LogLevelSource is constrained.

Methods

Name Description
LogActivity<TDescription>(in TDescription, Action, in OpenActivityOptions)

Executes an Action and logs its execution.

LogActivity<TDescription>(in TDescription, Action, in OpenActivityOptions, ref CallerInfo)
LogActivity<TDescription, TResult>(in TDescription, Func<TResult>, in OpenActivityOptions)

Executes a System.Func<> and logs its execution.

LogActivity<TDescription, TResult>(in TDescription, Func<TResult>, in OpenActivityOptions, ref CallerInfo)
LogActivityAsync<TDescription>(in TDescription, Func<Task>, in OpenActivityOptions)

Executes an asynchronous void delegate and logs its execution.

LogActivityAsync<TDescription>(in TDescription, Func<Task>, in OpenActivityOptions, ref CallerInfo)
LogActivityAsync<TDescription, TResult>(in TDescription, Func<Task<TResult>>, in OpenActivityOptions)

Executes an asynchronous non-void delegate and logs its execution.

LogActivityAsync<TDescription, TResult>(in TDescription, Func<Task<TResult>>, in OpenActivityOptions, ref CallerInfo)
OpenActivity<T>(in T, in OpenActivityOptions)

Opens an activity.

OpenActivity<T>(in T, in OpenActivityOptions, ref CallerInfo)
Write<T>(in T, in WriteMessageOptions)

Writes a message.

Write<T>(in T, in WriteMessageOptions, ref CallerInfo)
Write<T>(in T, Exception, in WriteMessageOptions)

Writes a message and specifies an Exception.

Write<T>(in T, Exception, in WriteMessageOptions, ref CallerInfo)