Skip to content

PgLog

Namespace: Ankus

Assembly: Ankus.Runtime.dll

Reports through PostgreSQL’s client and server diagnostics on the active backend thread.

public static class PgLog

Inheritance: object

Reports debugging text at detail level one.

public static void Debug1(PgDiagnostic diagnostic)

Parameters:

diagnostic — PgDiagnostic

The message and optional PostgreSQL diagnostic fields.

Reports debugging text at detail level one.

public static void Debug1(string message)

Parameters:

message — string

The primary message, treated as literal text.

Reports debugging text at detail level two.

public static void Debug2(PgDiagnostic diagnostic)

Parameters:

diagnostic — PgDiagnostic

The message and optional PostgreSQL diagnostic fields.

Reports debugging text at detail level two.

public static void Debug2(string message)

Parameters:

message — string

The primary message, treated as literal text.

Reports debugging text at detail level three.

public static void Debug3(PgDiagnostic diagnostic)

Parameters:

diagnostic — PgDiagnostic

The message and optional PostgreSQL diagnostic fields.

Reports debugging text at detail level three.

public static void Debug3(string message)

Parameters:

message — string

The primary message, treated as literal text.

Reports debugging text at detail level four.

public static void Debug4(PgDiagnostic diagnostic)

Parameters:

diagnostic — PgDiagnostic

The message and optional PostgreSQL diagnostic fields.

Reports debugging text at detail level four.

public static void Debug4(string message)

Parameters:

message — string

The primary message, treated as literal text.

Reports debugging text at detail level five.

public static void Debug5(PgDiagnostic diagnostic)

Parameters:

diagnostic — PgDiagnostic

The message and optional PostgreSQL diagnostic fields.

Reports debugging text at detail level five.

public static void Debug5(string message)

Parameters:

message — string

The primary message, treated as literal text.

Throws a catchable PostgreSQL error after validating the active logging capability.

[DoesNotReturn]
public static void Error(PgDiagnostic diagnostic)

Parameters:

diagnostic — PgDiagnostic

The message and optional PostgreSQL diagnostic fields.

The default SQLSTATE is XX000. Explicit diagnostic fields and codes retain their meaning. An unhandled error is raised by PostgreSQL after managed frames unwind.

Throws a catchable PostgreSQL error after validating the active logging capability.

[DoesNotReturn]
public static void Error(string message)

Parameters:

message — string

The primary message, treated as literal text.

The default SQLSTATE is XX000. Explicit diagnostic fields and codes retain their meaning. An unhandled error is raised by PostgreSQL after managed frames unwind.

Records a terminal report and unwinds managed code before PostgreSQL terminates the connection.

[DoesNotReturn]
public static void Fatal(PgDiagnostic diagnostic)

Parameters:

diagnostic — PgDiagnostic

The message and optional PostgreSQL diagnostic fields.

The default SQLSTATE is XX000. Explicit diagnostic fields and codes retain their meaning. Catching the managed exception does not discard the terminal report.

Records a terminal report and unwinds managed code before PostgreSQL terminates the connection.

[DoesNotReturn]
public static void Fatal(string message)

Parameters:

message — string

The primary message, treated as literal text.

The default SQLSTATE is XX000. Explicit diagnostic fields and codes retain their meaning. Catching the managed exception does not discard the terminal report.

Reports information to the client regardless of client_min_messages.

public static void Info(PgDiagnostic diagnostic)

Parameters:

diagnostic — PgDiagnostic

The message and optional PostgreSQL diagnostic fields.

Reports information to the client regardless of client_min_messages.

public static void Info(string message)

Parameters:

message — string

The primary message, treated as literal text.

Tests PostgreSQL’s current reporting thresholds before formatting a message.

public static bool IsEnabled(PgLogLevel level)

Parameters:

level — PgLogLevel

The reporting severity.

Returns: bool

Whether PostgreSQL would process this level for either destination.

Reports an operational message with PostgreSQL’s LOG routing.

public static void Log(PgDiagnostic diagnostic)

Parameters:

diagnostic — PgDiagnostic

The message and optional PostgreSQL diagnostic fields.

Reports an operational message with PostgreSQL’s LOG routing.

public static void Log(string message)

Parameters:

message — string

The primary message, treated as literal text.

Reports an expected event without stopping execution.

public static void Notice(PgDiagnostic diagnostic)

Parameters:

diagnostic — PgDiagnostic

The message and optional PostgreSQL diagnostic fields.

Reports an expected event without stopping execution.

public static void Notice(string message)

Parameters:

message — string

The primary message, treated as literal text.

Records a terminal report and unwinds managed code before PostgreSQL starts cluster crash recovery.

[DoesNotReturn]
public static void Panic(PgDiagnostic diagnostic)

Parameters:

diagnostic — PgDiagnostic

The message and optional PostgreSQL diagnostic fields.

The default SQLSTATE is XX000. Explicit diagnostic fields and codes retain their meaning. Catching the managed exception does not discard the terminal report.

Records a terminal report and unwinds managed code before PostgreSQL starts cluster crash recovery.

[DoesNotReturn]
public static void Panic(string message)

Parameters:

message — string

The primary message, treated as literal text.

The default SQLSTATE is XX000. Explicit diagnostic fields and codes retain their meaning. Catching the managed exception does not discard the terminal report.

Reports an operational message to the server only.

public static void ServerOnly(PgDiagnostic diagnostic)

Parameters:

diagnostic — PgDiagnostic

The message and optional PostgreSQL diagnostic fields.

Reports an operational message to the server only.

public static void ServerOnly(string message)

Parameters:

message — string

The primary message, treated as literal text.

Reports an unexpected event without stopping execution.

public static void Warning(PgDiagnostic diagnostic)

Parameters:

diagnostic — PgDiagnostic

The message and optional PostgreSQL diagnostic fields.

Reports an unexpected event without stopping execution.

public static void Warning(string message)

Parameters:

message — string

The primary message, treated as literal text.

Reports structured diagnostics using PostgreSQL’s filtering and routing rules. Terminal reports remain pending until the native boundary even if extension code catches their managed exception.

public static void Write(PgLogLevel level, PgDiagnostic diagnostic)

Parameters:

level — PgLogLevel

The reporting severity.

diagnostic — PgDiagnostic

The message and optional diagnostic fields.

Messages below ERROR defer PostgreSQL interrupts while the native reporter emits the message. Call Check() periodically in loops that otherwise only report messages. Reporting failures still follow the ordinary native error recovery contract.

Write(PgLogLevel, ref PgLogInterpolatedStringHandler)

Section titled “Write(PgLogLevel, ref PgLogInterpolatedStringHandler)”

Reports an interpolated message, evaluating and formatting its expressions only when PostgreSQL would report the level, as pgrx’s logging macros do. ERROR throws PgException; FATAL and PANIC unwind to the generated native boundary before reporting.

public static void Write(PgLogLevel level, ref PgLogInterpolatedStringHandler message)

Parameters:

level — PgLogLevel

The reporting severity.

message — PgLogInterpolatedStringHandler

The interpolated primary message.

Reports literal text. ERROR throws PgException; FATAL and PANIC unwind to the generated native boundary before reporting.

public static void Write(PgLogLevel level, string message)

Parameters:

level — PgLogLevel

The reporting severity.

message — string

The primary message.