PostSharp / / API Reference / Post­Sharp.​Patterns.​Diagnostics / Logger
Open sandbox

Class Logger

Allows to emit custom log records and define custom activities. This class is obsolete. Use LogSource for new developments.

Inheritance
Logger
Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common.dll
Syntax
[RequirePostSharp]
[RequirePostSharp("PostSharp.Patterns.Common.Weaver", "AddCallerInfoTask", AnyTypeReference = true)]
public class Logger : Object

Properties

Name Description
IsOpenActivityEnabled

Methods

Name Description
ForCurrentContext()
GetLogger(String)

Gets a Logger for a given role and for the calling type.

GetLogger(String, ref CallerInfo)
GetLogger(String, Type)

Gets a Logger for a given role and Type.

IsEnabled(LogLevel)

Determines whether logging is enabled in the current Logger for a given LogLevel.

OpenActivity(LogActivityOptions, String)
OpenActivity(LogActivityOptions, String, ref CallerInfo)
OpenActivity(LogActivityOptions, String, Object[])
OpenActivity(LogActivityOptions, String, Object[], ref CallerInfo)
OpenActivity(String)

Opens a custom activity with an optional description, but without parameters.

OpenActivity(String, ref CallerInfo)
OpenActivity(String, Object[])

Opens a custom activity with an array of parameters.

OpenActivity(String, Object[], ref CallerInfo)
OpenActivity<T1>(LogActivityOptions, String, T1)

Opens a custom activity with 1 parameter.

OpenActivity<T1>(LogActivityOptions, String, T1, ref CallerInfo)
OpenActivity<T1>(String, T1)

Opens a custom activity with a description containing 1 parameter.

OpenActivity<T1>(String, T1, ref CallerInfo)
OpenActivity<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)

Opens a custom activity with 10 parameters.

OpenActivity<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, ref CallerInfo)
OpenActivity<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)

Opens a custom activity with a description containing 10 parameters.

OpenActivity<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, ref CallerInfo)
OpenActivity<T1, T2>(LogActivityOptions, String, T1, T2)

Opens a custom activity with 2 parameters.

OpenActivity<T1, T2>(LogActivityOptions, String, T1, T2, ref CallerInfo)
OpenActivity<T1, T2>(String, T1, T2)

Opens a custom activity with a description containing 2 parameters.

OpenActivity<T1, T2>(String, T1, T2, ref CallerInfo)
OpenActivity<T1, T2, T3>(LogActivityOptions, String, T1, T2, T3)

Opens a custom activity with 3 parameters.

OpenActivity<T1, T2, T3>(LogActivityOptions, String, T1, T2, T3, ref CallerInfo)
OpenActivity<T1, T2, T3>(String, T1, T2, T3)

Opens a custom activity with a description containing 3 parameters.

OpenActivity<T1, T2, T3>(String, T1, T2, T3, ref CallerInfo)
OpenActivity<T1, T2, T3, T4>(LogActivityOptions, String, T1, T2, T3, T4)

Opens a custom activity with 4 parameters.

OpenActivity<T1, T2, T3, T4>(LogActivityOptions, String, T1, T2, T3, T4, ref CallerInfo)
OpenActivity<T1, T2, T3, T4>(String, T1, T2, T3, T4)

Opens a custom activity with a description containing 4 parameters.

OpenActivity<T1, T2, T3, T4>(String, T1, T2, T3, T4, ref CallerInfo)
OpenActivity<T1, T2, T3, T4, T5>(LogActivityOptions, String, T1, T2, T3, T4, T5)

Opens a custom activity with 5 parameters.

OpenActivity<T1, T2, T3, T4, T5>(LogActivityOptions, String, T1, T2, T3, T4, T5, ref CallerInfo)
OpenActivity<T1, T2, T3, T4, T5>(String, T1, T2, T3, T4, T5)

Opens a custom activity with a description containing 5 parameters.

OpenActivity<T1, T2, T3, T4, T5>(String, T1, T2, T3, T4, T5, ref CallerInfo)
OpenActivity<T1, T2, T3, T4, T5, T6>(LogActivityOptions, String, T1, T2, T3, T4, T5, T6)

Opens a custom activity with 6 parameters.

OpenActivity<T1, T2, T3, T4, T5, T6>(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, ref CallerInfo)
OpenActivity<T1, T2, T3, T4, T5, T6>(String, T1, T2, T3, T4, T5, T6)

Opens a custom activity with a description containing 6 parameters.

OpenActivity<T1, T2, T3, T4, T5, T6>(String, T1, T2, T3, T4, T5, T6, ref CallerInfo)
OpenActivity<T1, T2, T3, T4, T5, T6, T7>(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7)

Opens a custom activity with 7 parameters.

OpenActivity<T1, T2, T3, T4, T5, T6, T7>(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7, ref CallerInfo)
OpenActivity<T1, T2, T3, T4, T5, T6, T7>(String, T1, T2, T3, T4, T5, T6, T7)

Opens a custom activity with a description containing 7 parameters.

OpenActivity<T1, T2, T3, T4, T5, T6, T7>(String, T1, T2, T3, T4, T5, T6, T7, ref CallerInfo)
OpenActivity<T1, T2, T3, T4, T5, T6, T7, T8>(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7, T8)

Opens a custom activity with 8 parameters.

OpenActivity<T1, T2, T3, T4, T5, T6, T7, T8>(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7, T8, ref CallerInfo)
OpenActivity<T1, T2, T3, T4, T5, T6, T7, T8>(String, T1, T2, T3, T4, T5, T6, T7, T8)

Opens a custom activity with a description containing 8 parameters.

OpenActivity<T1, T2, T3, T4, T5, T6, T7, T8>(String, T1, T2, T3, T4, T5, T6, T7, T8, ref CallerInfo)
OpenActivity<T1, T2, T3, T4, T5, T6, T7, T8, T9>(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7, T8, T9)

Opens a custom activity with 9 parameters.

OpenActivity<T1, T2, T3, T4, T5, T6, T7, T8, T9>(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7, T8, T9, ref CallerInfo)
OpenActivity<T1, T2, T3, T4, T5, T6, T7, T8, T9>(String, T1, T2, T3, T4, T5, T6, T7, T8, T9)

Opens a custom activity with a description containing 9 parameters.

OpenActivity<T1, T2, T3, T4, T5, T6, T7, T8, T9>(String, T1, T2, T3, T4, T5, T6, T7, T8, T9, ref CallerInfo)
OpenAsyncActivity(LogActivityOptions, String)
OpenAsyncActivity(LogActivityOptions, String, ref CallerInfo)
OpenAsyncActivity(LogActivityOptions, String, Object[])
OpenAsyncActivity(LogActivityOptions, String, Object[], ref CallerInfo)
OpenAsyncActivity(String)
OpenAsyncActivity(String, ref CallerInfo)
OpenAsyncActivity(String, Object[])
OpenAsyncActivity(String, Object[], ref CallerInfo)
OpenAsyncActivity<T1>(LogActivityOptions, String, T1)
OpenAsyncActivity<T1>(LogActivityOptions, String, T1, ref CallerInfo)
OpenAsyncActivity<T1>(String, T1)
OpenAsyncActivity<T1>(String, T1, ref CallerInfo)
OpenAsyncActivity<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)
OpenAsyncActivity<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, ref CallerInfo)
OpenAsyncActivity<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)
OpenAsyncActivity<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, ref CallerInfo)
OpenAsyncActivity<T1, T2>(LogActivityOptions, String, T1, T2)
OpenAsyncActivity<T1, T2>(LogActivityOptions, String, T1, T2, ref CallerInfo)
OpenAsyncActivity<T1, T2>(String, T1, T2)
OpenAsyncActivity<T1, T2>(String, T1, T2, ref CallerInfo)
OpenAsyncActivity<T1, T2, T3>(LogActivityOptions, String, T1, T2, T3)
OpenAsyncActivity<T1, T2, T3>(LogActivityOptions, String, T1, T2, T3, ref CallerInfo)
OpenAsyncActivity<T1, T2, T3>(String, T1, T2, T3)
OpenAsyncActivity<T1, T2, T3>(String, T1, T2, T3, ref CallerInfo)
OpenAsyncActivity<T1, T2, T3, T4>(LogActivityOptions, String, T1, T2, T3, T4)
OpenAsyncActivity<T1, T2, T3, T4>(LogActivityOptions, String, T1, T2, T3, T4, ref CallerInfo)
OpenAsyncActivity<T1, T2, T3, T4>(String, T1, T2, T3, T4)
OpenAsyncActivity<T1, T2, T3, T4>(String, T1, T2, T3, T4, ref CallerInfo)
OpenAsyncActivity<T1, T2, T3, T4, T5>(LogActivityOptions, String, T1, T2, T3, T4, T5)
OpenAsyncActivity<T1, T2, T3, T4, T5>(LogActivityOptions, String, T1, T2, T3, T4, T5, ref CallerInfo)
OpenAsyncActivity<T1, T2, T3, T4, T5>(String, T1, T2, T3, T4, T5)
OpenAsyncActivity<T1, T2, T3, T4, T5>(String, T1, T2, T3, T4, T5, ref CallerInfo)
OpenAsyncActivity<T1, T2, T3, T4, T5, T6>(LogActivityOptions, String, T1, T2, T3, T4, T5, T6)
OpenAsyncActivity<T1, T2, T3, T4, T5, T6>(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, ref CallerInfo)
OpenAsyncActivity<T1, T2, T3, T4, T5, T6>(String, T1, T2, T3, T4, T5, T6)
OpenAsyncActivity<T1, T2, T3, T4, T5, T6>(String, T1, T2, T3, T4, T5, T6, ref CallerInfo)
OpenAsyncActivity<T1, T2, T3, T4, T5, T6, T7>(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7)
OpenAsyncActivity<T1, T2, T3, T4, T5, T6, T7>(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7, ref CallerInfo)
OpenAsyncActivity<T1, T2, T3, T4, T5, T6, T7>(String, T1, T2, T3, T4, T5, T6, T7)
OpenAsyncActivity<T1, T2, T3, T4, T5, T6, T7>(String, T1, T2, T3, T4, T5, T6, T7, ref CallerInfo)
OpenAsyncActivity<T1, T2, T3, T4, T5, T6, T7, T8>(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7, T8)
OpenAsyncActivity<T1, T2, T3, T4, T5, T6, T7, T8>(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7, T8, ref CallerInfo)
OpenAsyncActivity<T1, T2, T3, T4, T5, T6, T7, T8>(String, T1, T2, T3, T4, T5, T6, T7, T8)
OpenAsyncActivity<T1, T2, T3, T4, T5, T6, T7, T8>(String, T1, T2, T3, T4, T5, T6, T7, T8, ref CallerInfo)
OpenAsyncActivity<T1, T2, T3, T4, T5, T6, T7, T8, T9>(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7, T8, T9)
OpenAsyncActivity<T1, T2, T3, T4, T5, T6, T7, T8, T9>(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7, T8, T9, ref CallerInfo)
OpenAsyncActivity<T1, T2, T3, T4, T5, T6, T7, T8, T9>(String, T1, T2, T3, T4, T5, T6, T7, T8, T9)
OpenAsyncActivity<T1, T2, T3, T4, T5, T6, T7, T8, T9>(String, T1, T2, T3, T4, T5, T6, T7, T8, T9, ref CallerInfo)
ToLogSource()

Creates a LogSource from the current legacy Logger.

Write(LogLevel, String)

Writes a custom log record without parameters.

Write(LogLevel, String, ref CallerInfo)
Write(LogLevel, String, Object[])

Writes a custom log record with an array of parameters.

Write(LogLevel, String, Object[], ref CallerInfo)
Write<T1>(LogLevel, String, T1)

Writes a custom log record with 1 parameter.

Write<T1>(LogLevel, String, T1, ref CallerInfo)
Write<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(LogLevel, String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)

Writes a custom log record with 10 parameters.

Write<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(LogLevel, String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, ref CallerInfo)
Write<T1, T2>(LogLevel, String, T1, T2)

Writes a custom log record with 2 parameters.

Write<T1, T2>(LogLevel, String, T1, T2, ref CallerInfo)
Write<T1, T2, T3>(LogLevel, String, T1, T2, T3)

Writes a custom log record with 3 parameters.

Write<T1, T2, T3>(LogLevel, String, T1, T2, T3, ref CallerInfo)
Write<T1, T2, T3, T4>(LogLevel, String, T1, T2, T3, T4)

Writes a custom log record with 4 parameters.

Write<T1, T2, T3, T4>(LogLevel, String, T1, T2, T3, T4, ref CallerInfo)
Write<T1, T2, T3, T4, T5>(LogLevel, String, T1, T2, T3, T4, T5)

Writes a custom log record with 5 parameters.

Write<T1, T2, T3, T4, T5>(LogLevel, String, T1, T2, T3, T4, T5, ref CallerInfo)
Write<T1, T2, T3, T4, T5, T6>(LogLevel, String, T1, T2, T3, T4, T5, T6)

Writes a custom log record with 6 parameters.

Write<T1, T2, T3, T4, T5, T6>(LogLevel, String, T1, T2, T3, T4, T5, T6, ref CallerInfo)
Write<T1, T2, T3, T4, T5, T6, T7>(LogLevel, String, T1, T2, T3, T4, T5, T6, T7)

Writes a custom log record with 7 parameters.

Write<T1, T2, T3, T4, T5, T6, T7>(LogLevel, String, T1, T2, T3, T4, T5, T6, T7, ref CallerInfo)
Write<T1, T2, T3, T4, T5, T6, T7, T8>(LogLevel, String, T1, T2, T3, T4, T5, T6, T7, T8)

Writes a custom log record with 8 parameters.

Write<T1, T2, T3, T4, T5, T6, T7, T8>(LogLevel, String, T1, T2, T3, T4, T5, T6, T7, T8, ref CallerInfo)
Write<T1, T2, T3, T4, T5, T6, T7, T8, T9>(LogLevel, String, T1, T2, T3, T4, T5, T6, T7, T8, T9)

Writes a custom log record with 9 parameters.

Write<T1, T2, T3, T4, T5, T6, T7, T8, T9>(LogLevel, String, T1, T2, T3, T4, T5, T6, T7, T8, T9, ref CallerInfo)
WriteException(LogLevel, Exception, String)

Writes a custom record without parameters and associates it with an Exception.

WriteException(LogLevel, Exception, String, ref CallerInfo)
WriteException(LogLevel, Exception, String, Object[])

Writes a custom record with an array of parameters and associates it with an Exception.

WriteException(LogLevel, Exception, String, Object[], ref CallerInfo)
WriteException<T1>(LogLevel, Exception, String, T1)

Writes a custom log record with 1 parameter and associates it with an Exception.

WriteException<T1>(LogLevel, Exception, String, T1, ref CallerInfo)
WriteException<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(LogLevel, Exception, String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)

Writes a custom log record with 10 parameters and associates it with an Exception.

WriteException<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(LogLevel, Exception, String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, ref CallerInfo)
WriteException<T1, T2>(LogLevel, Exception, String, T1, T2)

Writes a custom log record with 2 parameters and associates it with an Exception.

WriteException<T1, T2>(LogLevel, Exception, String, T1, T2, ref CallerInfo)
WriteException<T1, T2, T3>(LogLevel, Exception, String, T1, T2, T3)

Writes a custom log record with 3 parameters and associates it with an Exception.

WriteException<T1, T2, T3>(LogLevel, Exception, String, T1, T2, T3, ref CallerInfo)
WriteException<T1, T2, T3, T4>(LogLevel, Exception, String, T1, T2, T3, T4)

Writes a custom log record with 4 parameters and associates it with an Exception.

WriteException<T1, T2, T3, T4>(LogLevel, Exception, String, T1, T2, T3, T4, ref CallerInfo)
WriteException<T1, T2, T3, T4, T5>(LogLevel, Exception, String, T1, T2, T3, T4, T5)

Writes a custom log record with 5 parameters and associates it with an Exception.

WriteException<T1, T2, T3, T4, T5>(LogLevel, Exception, String, T1, T2, T3, T4, T5, ref CallerInfo)
WriteException<T1, T2, T3, T4, T5, T6>(LogLevel, Exception, String, T1, T2, T3, T4, T5, T6)

Writes a custom log record with 6 parameters and associates it with an Exception.

WriteException<T1, T2, T3, T4, T5, T6>(LogLevel, Exception, String, T1, T2, T3, T4, T5, T6, ref CallerInfo)
WriteException<T1, T2, T3, T4, T5, T6, T7>(LogLevel, Exception, String, T1, T2, T3, T4, T5, T6, T7)

Writes a custom log record with 7 parameters and associates it with an Exception.

WriteException<T1, T2, T3, T4, T5, T6, T7>(LogLevel, Exception, String, T1, T2, T3, T4, T5, T6, T7, ref CallerInfo)
WriteException<T1, T2, T3, T4, T5, T6, T7, T8>(LogLevel, Exception, String, T1, T2, T3, T4, T5, T6, T7, T8)

Writes a custom log record with 8 parameters and associates it with an Exception.

WriteException<T1, T2, T3, T4, T5, T6, T7, T8>(LogLevel, Exception, String, T1, T2, T3, T4, T5, T6, T7, T8, ref CallerInfo)
WriteException<T1, T2, T3, T4, T5, T6, T7, T8, T9>(LogLevel, Exception, String, T1, T2, T3, T4, T5, T6, T7, T8, T9)

Writes a custom log record with 9 parameters and associates it with an Exception.

WriteException<T1, T2, T3, T4, T5, T6, T7, T8, T9>(LogLevel, Exception, String, T1, T2, T3, T4, T5, T6, T7, T8, T9, ref CallerInfo)
WriteExecutionPoint()

Emits a log record with the source file and line of the caller.

WriteExecutionPoint(ref CallerInfo)