This is the online documentation for PostSharp 5.0.
Download PDF or CHM. Go to v4.3 or v5.0

LoggingProfile Class

Logging profiles are named configurations of logging aspects and influence the way PostSharp generates the code instrumentation. They are typically instantiated in postsharp.config.
Inheritance Hierarchy
System.Object
  PostSharp.Patterns.Diagnostics.LoggingProfile

Namespace:  PostSharp.Patterns.Diagnostics
Assembly:  PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 5.0.31.0 (5.0.31.0)
Syntax
C#
public class LoggingProfile

The LoggingProfile type exposes the following members.

Constructors
  NameDescription
Public methodLoggingProfile
Initializes a new instance of the LoggingProfile class
Top
Properties
  NameDescription
Public propertyAllowDynamicEnabling
Determines whether logging can be dynamically enabled or disabled after initialization. The default value of this property is true. When it is set to false, PostSharp generates code that allows the JIT compiler to completely remove logging instructions for types that are not enabled.
Public propertyBackend
Gets the LoggingBackend associated with the current profile.
Public propertyDefaultOptions
Gets or sets the options for "normal" records, e.g. method entry, method success, or value change.
Public propertyDescription
Gets or sets a human-readable description for the current profile. The description is only used when representing the profile in PostSharp Tools for Visual Studio.
Public propertyEnabledRecordKinds
Gets or sets the set of record kinds that are enabled for the given profile. Change it with care. Not all combinations are tested.
Public propertyExceptionOptions
Gets or sets the options for "exception" records, e.g. method exceptions or slow executions.
Public propertyExecutionTimeThreshold
Gets or sets the warning threshold, in milliseconds. If the execution of a method takes longer than that, its success is logged with Warning, and the time it took is logged. If the value is 0, this feature is disabled.
Public propertyIncludeAwaitedTask
Determines whether the operand of the await operator should be included in the log.
Public propertyIncludeExecutionTime
Indicates that the execution time of a method should be tracked and logged on exit.
Public propertyIncludeSourceLineInfo
Determines whether source-line information should be included in the log.
Public propertyName
Gets or sets the name of the current profile. The name of the profile should match the constructor argument of the LogAttribute aspect.
Public propertyRole
Gets or sets the role of the current profile. Profiles of different roles can have different run-time options, including different back-ends. See Roles to access role-based run-time options.
Top
Methods
  NameDescription
Protected methodEnsureNotFrozen
Throws an InvalidOperationException if the Freeze() method has been called on this object.
Protected methodFreeze
Prevents changes in the current object.
Public methodGetSource
Gets the LoggingTypeSource for a given Type.
Public methodToString (Overrides Object.ToString().)
Top
Extension Methods
  NameDescription
Public Extension MethodQueryInterface<T>
Gets the implementation of a specified interface for the specified object.
(Defined by QueryInterfaceExtensions.)
Top
Remarks

Logging profiles can then be referred to from the LogAttribute. There are two system-defined logging profiles, Default (the default profile for LogAttribute), Exceptions (default for LogExceptionAttribute), and Audit (default for AuditAttribute).

See Also