Custom attribute that, when applied on a method, causes PostSharp to implement tracing before and after the execution of this method.
Inheritance
Implements
Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics.dll
Syntax
public class LogAttribute : LogAttributeBase, IMethodLevelAspect, IMethodLevelAspectBuildSemantics, IAspectBuildSemantics, IValidableAnnotation, ILogAspect, IAspectRemarks
By default, this custom attribute follows the settings of the default profile, which adds a Debug message
on entry and on success, and a Warning message on exception. All messages include parameter values. You
can change these default settings by editing the logging profile in postsharp.config, or by passing the name of a different
logging profile to the LogAttribute(string) constructor. See LoggingProfile.
To add logging to many methods, apply this attribute to the assembly and filter the targets with the multicasting properties,
or add it to all projects of a directory with postsharp.config.
The aspect only emits log records. To write them, set DefaultBackend to a LoggingBackend when the application starts. Until then, the records are sent to the NullLoggingBackend, which discards them.
Constructors
| Name | Description |
|---|---|
| LogAttribute() | Initializes a new instance of the LogAttribute class. |
| LogAttribute(string) | Initializes a new instance of the LogAttribute class and specifies a logging profile. |