Open sandboxFocus
  • TOC

Post­Sharp Documentation

Introduction

Deployment and Configuration

Adding Aspects to Code

Logging

Contracts

INotify­Property­Changed

Weak Event

XAML

Parent/Child, Visitor and Disposable

Undo/Redo

Caching

Multithreading

Developing Custom Aspects

Validating Architecture

Testing and Debugging

Miscellaneous

API Reference

Post­Sharp

Post­Sharp.​Aspects

Post­Sharp.​Aspects.​Advices

Post­Sharp.​Aspects.​Configuration

Post­Sharp.​Aspects.​Dependencies

Post­Sharp.​Aspects.​Internals

Post­Sharp.​Aspects.​Serialization

Post­Sharp.​Collections

Post­Sharp.​Constraints

Post­Sharp.​Extensibility

Post­Sharp.​Extensibility.​Build­Time­Logging

Post­Sharp.​Patterns

Post­Sharp.​Patterns.​Caching

Post­Sharp.​Patterns.​Caching.​Backends

Post­Sharp.​Patterns.​Caching.​Backends.​Azure

Post­Sharp.​Patterns.​Caching.​Backends.​Redis

Post­Sharp.​Patterns.​Caching.​Dependencies

Post­Sharp.​Patterns.​Caching.​Formatters

Post­Sharp.​Patterns.​Caching.​Implementation

Post­Sharp.​Patterns.​Caching.​Locking

Post­Sharp.​Patterns.​Caching.​Serializers

Post­Sharp.​Patterns.​Caching.​Value­Adapters

Post­Sharp.​Patterns.​Collections

Post­Sharp.​Patterns.​Collections.​Advices

Post­Sharp.​Patterns.​Contracts

Post­Sharp.​Patterns.​Diagnostics

Close­Activity­Options

Context­Id­Generation­Strategy

Custom­Record­Logging­Options

Default­Logging­Exception­Handler

Formatted­Message­Builder

ILog­Activity

ILog­Aspect

ILogging­Exception­Handler

ILog­Value­Aspect

Log­Activity2

Log­Activity<TActivity­Description>

Log­Activity­Kind

Log­Activity­Options

Log­Attribute6

Log­Attribute­Base5

Log­Exception­Attribute6

Logger

Logger­Factory­Extensions

Logging­Abstract­Source

Logging­Backend

Logging­Backend­Options

Logging­Build­Time­Configuration

Logging­Configuration­Manager

Logging­Context­Local­Configuration

Logging­Context­Local­Configuration­Scope

Logging­Context­Mismatch­Exception2

Logging­Exception2

Logging­Exception­Info

Logging­Namespace­Source

Logging­Options

Logging­Options.​Serializer2

Logging­Profile

Logging­Profile.​Serializer2

Logging­Profile­Collection3

Logging­Profile­Repository

Logging­Property

Logging­Role­Configuration

Logging­Role­Configuration­Repository

Logging­Roles

Logging­Services

Logging­Services.​Formatters2

Logging­Source­Local­State

Logging­Type­Source2

Logging­Verbosity­Configuration

Log­Level

Log­Record­Kind

Log­Record­Kind­Extensions

Log­Source

Log­Value­Attribute5

Not­Logged­Attribute2

Open­Activity­Options

Semantic­Message­Builder

Throwing­Logging­Exception­Handler

Write­Message­Options

Post­Sharp.​Patterns.​Diagnostics.​Adapters.​Asp­Net­Core

Post­Sharp.​Patterns.​Diagnostics.​Adapters.​Asp­Net­Framework

Post­Sharp.​Patterns.​Diagnostics.​Adapters.​Diagnostic­Source

Post­Sharp.​Patterns.​Diagnostics.​Adapters.​Http­Client

Post­Sharp.​Patterns.​Diagnostics.​Audit

Post­Sharp.​Patterns.​Diagnostics.​Backends

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Application­Insights

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Audit

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Common­Logging

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Console

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Event­Source

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Log4Net

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Microsoft

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Multiplexer

Post­Sharp.​Patterns.​Diagnostics.​Backends.​NLog

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Null

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Serilog

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Trace

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Trace­Source

Post­Sharp.​Patterns.​Diagnostics.​Contexts

Post­Sharp.​Patterns.​Diagnostics.​Correlation

Post­Sharp.​Patterns.​Diagnostics.​Custom

Post­Sharp.​Patterns.​Diagnostics.​Custom.​Messages

Post­Sharp.​Patterns.​Diagnostics.​Formatters

Post­Sharp.​Patterns.​Diagnostics.​Record­Builders

Post­Sharp.​Patterns.​Diagnostics.​Threading­Instrumentation

Post­Sharp.​Patterns.​Diagnostics.​Transactions

Post­Sharp.​Patterns.​Diagnostics.​Transactions.​Model

Post­Sharp.​Patterns.​Dynamic­Advising

Post­Sharp.​Patterns.​Formatters

Post­Sharp.​Patterns.​Model

Post­Sharp.​Patterns.​Model.​Controls

Post­Sharp.​Patterns.​Model.​Type­Adapters

Post­Sharp.​Patterns.​Recording

Post­Sharp.​Patterns.​Recording.​Operations

Post­Sharp.​Patterns.​Threading

Post­Sharp.​Patterns.​Threading.​Models

Post­Sharp.​Patterns.​Utilities

Post­Sharp.​Patterns.​Xaml

Post­Sharp.​Reflection

Post­Sharp.​Reflection.​Method­Body

Post­Sharp.​Serialization

  • Article

Class LoggingProfile

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
LoggingProfile
Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics.dll
Syntax
[Serializer(typeof(LoggingProfile.Serializer))]
public class LoggingProfile
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).

Constructors

Name Description
LoggingProfile()
LoggingProfile(PortableFormatterConstructorContext)

Properties

Name Description
AllowDynamicEnabling

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.

Backend

Gets the LoggingBackend associated with the current profile.

DefaultOptions

Gets or sets the options for "normal" records, e.g. method entry, method success, or value change.

Description

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.

EnabledRecordKinds

Gets or sets the set of record kinds that are enabled for the given profile. Change it with care. Not all combinations are tested.

ExceptionOptions

Gets or sets the options for "exception" records, e.g. method exceptions or slow executions.

ExecutionTimeThreshold

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.

IncludeAwaitedTask

Determines whether the operand of the await operator should be included in the log.

IncludeExecutionTime

Indicates that the execution time of a method should be tracked and logged on exit.

IncludeSourceLineInfo

Determines whether source-line information should be included in the log.

Name

Gets or sets the name of the current profile. The name of the profile should match the constructor argument of the LogAttribute aspect.

Role

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.

Methods

Name Description
EnsureNotFrozen()

Throws an InvalidOperationException if the Freeze() method has been called on this object.

Freeze()

Prevents changes in the current object.

GetAbstractSource(Type)

Gets the LoggingAbstractSource for a given Type in the current profile.

ToString()
  • Navigation