class Bezel::Plug::Logger

include Bezel::Plug

Logs one line per request, once the rest of the pipeline has answered, with the status the client gets (Conn#final_status: 404 when nothing answered, the error's when a plug raised), the method and path as this plug received them (before Plug::Head or Plug::MethodOverride change the method), and the request's id when Plug::RequestId ran before it: to standard error, or to on_event when given (for structured logs). Lines are written at the info level, so a LOG_LEVEL of warn or error silences them. The path is written percent-decoded, as Conn#path; control characters in it are escaped, so that a request cannot forge a line.

src/plug/logger.qz:30

Class methods

def self.new(on_event: shareable (Bezel::LogEvent) -> Void? = …) -> Bezel::Plug::Logger

The plug, reporting to on_event when given, else to standard error.

src/plug/logger.qz:36

Methods

def call(conn: Bezel::Conn) -> Bezel::Conn

The connection changed by this plug.

from Bezel::Plug

src/plug/logger.qz:38

def wrap(conn: Bezel::Conn, rest: (Bezel::Conn) -> Bezel::Conn) -> Bezel::Conn

Runs this plug, then rest (the plugs after it) unless it halted. Override it to act around the rest: its result is the request's.

from Bezel::Plug

src/plug/logger.qz:40