Base class for all method-level logging aspects.
Inheritance
Implements
Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics.dll
Syntax
[AttributeUsage(AttributeTargets.Assembly|AttributeTargets.Module|AttributeTargets.Class|AttributeTargets.Struct|AttributeTargets.Constructor|AttributeTargets.Method|AttributeTargets.Property|AttributeTargets.Event, AllowMultiple = true, Inherited = false)]
[MulticastAttributeUsage(MulticastTargets.Method|MulticastTargets.InstanceConstructor|MulticastTargets.StaticConstructor, TargetMemberAttributes = MulticastAttributes.NonAbstract, AllowMultiple = false)]
[Metric("UsedFeatures", "Patterns.Diagnostics.Logging")]
[ProvideAspectRole("Tracing")]
[AspectRoleDependency(AspectDependencyAction.Order, AspectDependencyPosition.After, "Validation")]
public abstract class LogAttributeBase : MethodLevelAspect, IMethodLevelAspect, IMethodLevelAspectBuildSemantics, IAspectBuildSemantics, IValidableAnnotation, ILogAspect, IAspectRemarks
The LoggingProfile named by the ProfileName property determines the build-time logging options of the aspect. To create an aspect that uses a specific profile by default, derive a class from LogAttributeBase and set ProfileName in its constructor, as LogExceptionAttribute does.
Logging aspects are ordered after the aspects of the Validation role, such as the contracts of
PostSharp.Patterns.Contracts. A call that fails a precondition throws before the logging code of the method runs,
so neither the entry nor the exception of this call is logged. Log the exception in the caller if it must be recorded.
Constructors
| Name | Description |
|---|---|
| LogAttributeBase() |
Properties
| Name | Description |
|---|---|
| ProfileName | Gets or sets the name of the LoggingProfile. |