Classes
_JSONFormatter
1
▼
Structured JSON log formatter for production observability.
_JSONFormatter
1
▼
Structured JSON log formatter for production observability.
Methods
format
1
str
▼
format
1
str
▼
def format(self, record: logging.LogRecord) -> str
Parameters
| Name | Type | Description |
|---|---|---|
record |
— |
Returns
str
Functions
configure_logging
1
None
▼
Configure stdlib logging for pounce and framework loggers.
Sets up the pounce …
configure_logging
1
None
▼
def configure_logging(config: ServerConfig) -> None
Configure stdlib logging for pounce and framework loggers.
Sets up the pounce logger hierarchy and the chirp framework logger with the configured log level and a stream handler to stderr. Both loggers share the same formatting and output destination.
Whenconfig.log_format is "json", uses structured JSON output.
Parameters
| Name | Type | Description |
|---|---|---|
config |
ServerConfig |
Server configuration with log_level and log_format settings. |
access_log
8
None
▼
Log an access log entry for a completed request.
When JSON logging is enabled,…
access_log
8
None
▼
def access_log(method: str, path: str, status: int, bytes_sent: int, duration_ms: float, client: str, *, http_version: str = '1.1', request_id: str | None = None) -> None
Log an access log entry for a completed request.
When JSON logging is enabled, emits a structured JSON object with all fields as top-level keys. Otherwise, uses the standard combined log format.
Parameters
| Name | Type | Description |
|---|---|---|
method |
str |
HTTP method (e.g., "GET"). |
path |
str |
Request path (e.g., "/api/users"). |
status |
int |
HTTP response status code. |
bytes_sent |
int |
Number of response body bytes sent. |
duration_ms |
float |
Request duration in milliseconds. |
client |
str |
Client address string (e.g., "127.0.0.1:5000"). |
http_version |
str |
Protocol version string (e.g., "1.1", "2"). Default:'1.1'
|
request_id |
str | None |
Optional request ID for tracing. Default:None
|