Post­Sharp Documentation / API Reference / Post­Sharp.​Patterns.​Diagnostics.​Record­Builders Namespace / Log­Record­Builder Class

LogRecordBuilder Class

Builds log record (typically, but not necessarily a string) for an action. You can think of the LogRecordBuilder as a semantic StringBuilder. PostSharp emits code that invoke methods such as SetParameter<T>(Int32, String, ParameterKind, String, T) or SetReturnValue<T>(Int32, String, String, T, IFormatter<T>), and the responsibility of the LogRecordBuilder is to format a record and emit it to the back-end.
Inheritance Hierarchy
System.Object
  PostSharp.Patterns.Diagnostics.RecordBuilders.LogRecordBuilder
    PostSharp.Patterns.Diagnostics.RecordBuilders.TextLogRecordBuilder

Namespace:  PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly:  PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.24.0 (6.0.24.0)
Syntax
C#
public abstract class LogRecordBuilder

The LogRecordBuilder type exposes the following members.

Constructors
  NameDescription
Protected methodLogRecordBuilder
Initializes a new instance of the LogRecordBuilder class
Properties
  NameDescription
Protected propertyContext
Gets the LoggingContext to which the record belongs.
Protected propertyRecordKind
Gets the kind of the current record (e.g. MethodEntry or MethodException).
Protected propertyThreadContext
Gets the ThreadLoggingContext to which the current LogRecordBuilder belongs.
Methods
  NameDescription
Public methodBeginCustomRecord
Initializes the current LogRecordBuilder to emit a custom record.
Public methodBeginRecord
Initializes the current LogRecordBuilder to emit a standard (i.e. non-custom) record for a given context and method.
Public methodComplete
Emits the record and resets the current LogRecordBuilder. This method invoked after all SetThis<T>(T), SetParameter<T>(Int32, String, ParameterKind, String, T) and similar methods have been called.
Protected methodEmitRecord
Emits the record. Invoked by the Complete() method.
Protected methodReset
Resets all fields and properties of the current LogRecordBuilder to their initial value. Invoked by the Complete() method.
Public methodSetException
Sets the exception for the method or activity.
Public methodSetExecutionTime
Sets the method or activity execution time.
Public methodSetMethodGenericParameter<T>
Not implemented.
Public methodSetParameter<T>(Int32, String, ParameterKind, String, T)
Sets the value of a given parameter and uses the default formatter.
Public methodSetParameter<T>(Int32, String, ParameterKind, String, T, IFormatter<T>)
Sets the value of a given parameter and specifies the Formatter<T>.
Public methodSetRefStructParameter
Public methodSetReturnValue<T>(Int32, String, String, T)
Sets a given return value (there can be several return values in C# 7.0) and uses the default formatter.
Public methodSetReturnValue<T>(Int32, String, String, T, IFormatter<T>)
Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter.
Public methodSetThis<T>(T)
Sets the this (instance) value and uses the default formatter. This method is only invoked if the IncludeThisValue property is true.
Public methodSetThis<T>(T, IFormatter<T>)
Sets the this (instance) value and uses a given formatter.
Public methodSetTypeGenericParameter<T>
Not implemented.
Public methodWriteCustomParameter<T>(Int32, ArraySegment<Char>, T)
Writes a custom parameter and uses the default formatter.
Public methodWriteCustomParameter<T>(Int32, ArraySegment<Char>, T, IFormatter<T>)
Writes a custom parameter and uses a given formatter.
Public methodWriteCustomString
Write a chunk of custom string.
See Also