Defines how the raw CLR object stored in a LogEventData is translated into a set of visitable properties and an expression that is accessible from the transaction policy expressions.
Namespace: PostSharp.Patterns.Diagnostics.Custom
Assembly: PostSharp.Patterns.Common.dll
Syntax
public class LogEventMetadataRemarks
The default implementation maps each public instance property of the CLR object to a logging property. Unless the object is of an anonymous type, it also takes the options of each property from the LoggingPropertyOptionsAttribute custom attribute.
Derive a class from LogEventMetadata to control the mapping, for instance to expose selected properties of an existing object without allocating a new one. To expose the object to transaction policy expressions, for instance to define custom transactions, derive from LogEventMetadata<TExpressionModel> instead, specify a Name, and reuse a single instance.
Constructors
| Name | Description |
|---|---|
| LogEventMetadata(string) | Initializes a new instance of the LogEventMetadata class. |
Properties
| Name | Description |
|---|---|
| Name | Gets the name of the current LogEventMetadata. This property may be undefined. It must be defined when the LogEventData must be available for evaluation from transaction policy expressions. In this case, the type of expression model (that is, the generic parameter of LogEventMetadata<TExpressionModel>) must be identical for identical values of the Name property. |
Methods
| Name | Description |
|---|---|
| GetPropertyOptions(string) | Gets the options of a given property. |
| HasInheritedProperty(object) | Determines whether the current LogEventMetadata contains any inherited property. The implementation of this method must not allocate heap memory. |
| VisitProperties<TVisitorState>(object, ILoggingPropertyVisitor<TVisitorState>, ref TVisitorState, in LoggingPropertyVisitorOptions) | Invokes an action for each property in the raw CLR object of a LogEventData. |