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.

System.Object
PostSharp.Patterns.Diagnostics.RecordBuilders.LogRecordBuilder
PostSharp.Patterns.Diagnostics.RecordBuilders.TextLogRecordBuilder
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.4.11.0 (6.4.11.0)

C#
public abstract class LogRecordBuilder : ICustomLogRecordBuilder, IDisposable
The LogRecordBuilder type exposes the following members.

Name | Description | |
---|---|---|
![]() | LogRecordBuilder | Initializes a new instance of the LogRecordBuilder class |

Name | Description | |
---|---|---|
![]() | Context |
Gets the LoggingContext to which the record belongs.
|
![]() | CustomRecordAttributes |
Describes how the LogRecordBuilder will be used, when it is being used to build a custom message or a custom activity.
|
![]() | IsDisposed |
Determines whether the current instance has been disposed.
|
![]() | RecordKind |
Gets the kind of the current record (e.g. MethodEntry or MethodException).
|
![]() | SyntheticId |
Gets a cross-process globally unique identifier for the current LoggingContext.
This value is created according to value of the LoggingBackend.Options.SyntheticIdFormatter property.
|
![]() | ThreadContext |
Gets the ThreadLoggingContext to which the current LogRecordBuilder belongs.
|

Name | Description | |
---|---|---|
![]() | BeginCustomRecord |
Initializes the current LogRecordBuilder to emit a custom record.
|
![]() | BeginRecord |
Initializes the current LogRecordBuilder to emit a standard (i.e. non-custom) record for
a given context and method.
|
![]() | BeginWriteItem | |
![]() | Complete |
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.
|
![]() | Dispose |
Finishes the logging of the current record. Calling this method does not actually make
the current LogRecordBuilder unusable, but it makes it usable for a
next record in the same thread.
|
![]() | EmitRecord |
Emits the record. Invoked by the Complete() method.
|
![]() | EndWriteItem |
Ends building a specified item.
|
![]() | ForEachProperty(LoggingPropertyVisitor<Object>) |
Invokes a delegate for each property defined in the current log record.
|
![]() | ForEachProperty<T>(LoggingPropertyVisitor<T>, T) |
Invokes a delegate for each property defined in the current log record.
|
![]() | Reset |
Resets all fields and properties of the current LogRecordBuilder to their initial value. Invoked by the
Complete() method.
|
![]() | SetException |
Sets the exception for the method or activity.
|
![]() | SetExecutionTime |
Sets the method or activity execution time.
|
![]() | SetMethodGenericParameter<T> |
Not implemented.
|
![]() | SetParameter<T>(Int32, String, ParameterKind, String, T) |
Sets the value of a given parameter and uses the default formatter.
|
![]() | SetParameter<T>(Int32, String, ParameterKind, String, T, IFormatter<T>) |
Sets the value of a given parameter and specifies the Formatter<T>.
|
![]() | SetReturnValue<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.
|
![]() | SetReturnValue<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.
|
![]() | SetThis<T>(T) |
Sets the this (instance) value and uses the default formatter. This method is only invoked if the IncludeThisValue property is true.
|
![]() | SetThis<T>(T, IFormatter<T>) |
Sets the this (instance) value and uses a given formatter.
|
![]() | SetTypeGenericParameter<T> |
Not implemented.
|
![]() | WriteCustomParameter<T>(Int32, ArraySegment<Char>, T) |
Writes a custom parameter (passed as an ArraySegment<char>) and uses the default formatter.
|
![]() | WriteCustomParameter<T>(Int32, CharSpan, T, CustomLogParameterOptions) |
Writes a custom parameter (passed as an CharSpan) and uses the default formatter.
|
![]() | WriteCustomParameter<T>(Int32, ArraySegment<Char>, T, IFormatter<T>) |
Writes a custom parameter (passed as an ArraySegment<char>) and uses a given formatter.
|
![]() | WriteCustomParameter<T>(Int32, CharSpan, T, CustomLogParameterOptions, IFormatter<T>) | |
![]() | WriteCustomString(ArraySegment<Char>) |
Write a custom string passed as an ArraySegment<char>.
|
![]() | WriteCustomString(CharSpan) |
