QueryFormatter
This class provides specialized logging formatting for database queries by intercepting log records and applying database-specific SQL formatting. It identifies the appropriate database connection via a record alias and automatically formats SQL strings found in the record arguments or attributes. This ensures that debug logs contain readable, pretty-printed SQL statements based on the specific backend's formatting rules.
Methods
format()
@classmethod
def format(
record: LogRecord
) - > string
Formats the specified logging record by beautifying any SQL queries present in the record's arguments or attributes using the database-specific debug SQL formatter.
Parameters
| Name | Type | Description |
|---|---|---|
| record | LogRecord | The logging record object containing the message, arguments, and optional database alias metadata to be processed. |
Returns
| Type | Description |
|---|---|
string | The fully formatted log message string, including the prettified SQL content if applicable. |