class Onyx::HTTP::Middleware::Logger

Overview

Logs requests colorfully into specified standard logger. It also logs the ::HTTP::Request#id if it's present. Should be put in the beginning of the middleware stack.

logger = Onyx::HTTP::Logger.new

#   INFO -- :     GET /users 200 102μs
#   INFO -- :     GET /favicon.ico 404 52μs
#   INFO -- :    POST /users 201 3.74ms

Included Modules

Defined in:

onyx-http/middleware/logger.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(logger : ::Logger = ::Logger.new(STDOUT), *, severity : ::Logger::Severity = ::Logger::INFO, query : Bool = true) #

Set query to false to turn off logging requests' queries.


[View source]

Instance Method Detail

def call(context) #

[View source]