Skip to content

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 PgLogInterpolatedStringHandler

The 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.

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.

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.

Appends a string.

public void AppendFormatted(string? value)

Parameters:

value — string

The string, or null for nothing.

Appends a formatted value.

public void AppendFormatted<T>(T value)

Type parameters:

T

The value’s type.

Parameters:

value — T

The value.

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.

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.

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.

Appends literal text.

public void AppendLiteral(string value)

Parameters:

value — string

The literal text.