Skip to content

HttpAccessLog ​

HttpAccessLog is the immutable event received by an app.onResponse(...) callback. It contains only routing and response metadata. It never includes a query string, headers, cookies, credentials, or body content.

Signature ​

tyrus
interface HttpAccessLog {
    readonly requestId: string;
    readonly method: string;
    readonly path: string;
    readonly status: HttpStatus;
    readonly duration: Duration;
}

requestId is also sent to the client in the x-request-id response header. duration is the elapsed server time until the response body finishes or is discarded, represented as a Duration from tyrus:temporal.

tyrus
import { HttpAccessLog, HttpStatus } from "tyrus:http";
import { Duration } from "tyrus:temporal";

function recordAccess(access: HttpAccessLog): void {
    const duration: Duration = access.duration;
    console.error(access.requestId, access.status);
}