PgLogInterpolatedStringHandler
Namespace: Ankus
Assembly: Ankus.Runtime.dll
Formats an interpolated log message only when PostgreSQL would report its level, as pgrx’s logging macros skip evaluating their arguments for disabled levels.
public ref struct PgLogInterpolatedStringHandlerThe C# compiler uses this handler for Write(PgLogLevel, ref PgLogInterpolatedStringHandler). When the level is below both of PostgreSQL’s reporting thresholds, no interpolated expression is evaluated and no text is built. ERROR and higher levels are always formatted.
Constructors
Section titled “Constructors”PgLogInterpolatedStringHandler(int, int, PgLogLevel, out bool)
Section titled “PgLogInterpolatedStringHandler(int, int, PgLogLevel, out bool)”Initializes the handler for one message, deciding whether to format it.
public PgLogInterpolatedStringHandler(int literalLength, int formattedCount, PgLogLevel level, out bool isEnabled)Parameters:
literalLength — int
The number of literal characters in the interpolated string.
formattedCount — int
The number of interpolated expressions.
level — PgLogLevel
The reporting severity.
isEnabled — bool
Receives whether the compiler should evaluate and append the interpolated expressions.
Methods
Section titled “Methods”AppendFormatted(scoped ReadOnlySpan<char>)
Section titled “AppendFormatted(scoped ReadOnlySpan<char>)”Appends characters.
public void AppendFormatted(scoped ReadOnlySpan<char> value)Parameters:
value — ReadOnlySpan<char>
The characters.
AppendFormatted(string?)
Section titled “AppendFormatted(string?)”Appends a string.
public void AppendFormatted(string? value)Parameters:
value — string
The string, or null for nothing.
AppendFormatted<T>(T)
Section titled “AppendFormatted<T>(T)”Appends a formatted value.
public void AppendFormatted<T>(T value)Type parameters:
T
The value’s type.
Parameters:
value — T
The value.
AppendFormatted<T>(T, int)
Section titled “AppendFormatted<T>(T, int)”Appends a value with an alignment.
public void AppendFormatted<T>(T value, int alignment)Type parameters:
T
The value’s type.
Parameters:
value — T
The value.
alignment — int
The minimum width; negative values align left.
AppendFormatted<T>(T, int, string?)
Section titled “AppendFormatted<T>(T, int, string?)”Appends a value with an alignment and a format string.
public void AppendFormatted<T>(T value, int alignment, string? format)Type parameters:
T
The value’s type.
Parameters:
value — T
The value.
alignment — int
The minimum width; negative values align left.
format — string
The format string.
AppendFormatted<T>(T, string?)
Section titled “AppendFormatted<T>(T, string?)”Appends a value with a format string.
public void AppendFormatted<T>(T value, string? format)Type parameters:
T
The value’s type.
Parameters:
value — T
The value.
format — string
The format string.
AppendLiteral(string)
Section titled “AppendLiteral(string)”Appends literal text.
public void AppendLiteral(string value)Parameters:
value — string
The literal text.