PostSharp6.2/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.2.8.0 (6.2.8.0)
Syntax
C#
public abstract class LogRecordBuilder : ICustomLogRecordBuilder, 
	IDisposable

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 propertyCustomRecordAttributes
Describes how the LogRecordBuilder will be used, when it is being used to build a custom message or a custom activity.
Public propertyIsDisposed
Determines whether the current instance has been disposed.
Protected propertyRecordKind
Gets the kind of the current record (e.g. MethodEntry or MethodException).
Public propertySyntheticId
Gets a cross-process globally unique identifier for the current LoggingContext. This value is created according to value of the LoggingBackend.Options.SyntheticIdFormatter property.
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 methodBeginWriteItem
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.
Public methodDispose
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Protected methodEmitRecord
Emits the record. Invoked by the Complete() method.
Public methodEndWriteItem
Ends building a specified item.
Public methodForEachProperty(LoggingPropertyVisitor<Object>)
Invokes a delegate for each property defined in the current log record.
Public methodForEachProperty<T>(LoggingPropertyVisitor<T>, T)
Invokes a delegate for each property defined in the current log record.
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 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 (passed as an ArraySegment<char>) and uses the default formatter.
Public methodWriteCustomParameter<T>(Int32, CharSpan, T, CustomLogParameterOptions)
Writes a custom parameter (passed as an CharSpan) and uses the default formatter.
Public methodWriteCustomParameter<T>(Int32, ArraySegment<Char>, T, IFormatter<T>)
Writes a custom parameter (passed as an ArraySegment<char>) and uses a given formatter.
Public methodWriteCustomParameter<T>(Int32, CharSpan, T, CustomLogParameterOptions, IFormatter<T>)
Public methodWriteCustomString(ArraySegment<Char>)
Write a custom string passed as an ArraySegment<char>.
Public methodWriteCustomString(CharSpan)
See Also