firebird.lib.logmsgs

Firebird log messages for Firebird log parser

Enums

Severity

class firebird.lib.logmsgs.Severity(value)[source]

Bases: IntEnum

Standard severity levels for Firebird log messages.

CRITICAL = 4
ERROR = 3
INFO = 1
UNKNOWN = 0
WARNING = 2

Facility

class firebird.lib.logmsgs.Facility(value)[source]

Bases: IntEnum

Identifies the Firebird server facility originating a log message.

AUTH = 11
CONFIG = 2
FILEIO = 4
GUARDIAN = 9
INTL = 3
NET = 10
PLUGIN = 8
SWEEP = 7
SYSTEM = 1
UNKNOWN = 0
USER = 5
VALIDATION = 6

Dataclasses

MsgDesc

class firebird.lib.logmsgs.MsgDesc(msg_id: int, severity: Severity, facility: Facility, msg_format: list[str])[source]

Bases: object

Describes the structure and metadata of a known Firebird log message type.

Parameters:
get_pattern(*, without_optional: bool) str[source]

Returns a str.format()-style pattern for the message.

Parameters:

without_optional (bool) – If True, the returned pattern excludes any parts following an ‘OPTIONAL’ marker in msg_format.

Returns:

A string pattern like “Operating system call {syscall} failed. Error code {error_code}”.

Return type:

str

facility: Facility

Firebird facility

msg_format: list[str]

A list defining the message structure. Contains literal string parts and placeholder strings like ‘{type:name}’ (e.g., ‘{s:syscall}’, ‘{d:error_code}’). The special string ‘OPTIONAL’ marks the beginning of an optional suffix.

msg_id: int

Message ID

severity: Severity

Message severity level

Functions

identify_msg

firebird.lib.logmsgs.identify_msg(msg: str) tuple[MsgDesc, dict[str, Any], bool] | None[source]

Attempts to identify a log message string against known message descriptors.

Parameters:

msg (str) – The textual content of a Firebird log entry (excluding timestamp/origin).

Returns:

  • The matched MsgDesc instance.

  • A dictionary mapping parameter names (from placeholders like {s:name}) to their extracted values (as strings or integers).

  • A boolean flag: True if the optional part of the message format (following ‘OPTIONAL’) was not present in the input msg, False otherwise.

Returns None if the msg does not match any known MsgDesc pattern.

Return type:

A tuple containing