class Amber::Pipe::Logger

Defined in:

amber/pipes/logger.cr

Constant Summary

SOURCE_COLORS = {:magenta, :magenta, :light_cyan, :light_blue, :light_blue, :light_yellow}

The color each source name is painted with, by position in SOURCE_NAMES.

SOURCE_NAMES = {"request", "Request", "headers", "cookies", "params", "session"}

The log sources this pipe writes to, in the order it writes them.

Constructors

Class Method Summary

Instance Method Summary

Instance methods inherited from class Amber::Pipe::Base

call(context : HTTP::Server::Context) call

Constructor Detail

def self.new(filter : Array(String) = log_config.filter, skip : Array(String) = log_config.skip, colorize : Bool = log_config.colorize) #

Reads Amber.settings only when the pipe is built, which happens in config/routes.cr after the app's initializers have registered their settings sections. A read while require "amber" runs would cache the settings before those sections exist.


[View source]

Class Method Detail

def self.writes_debug?(log : Log) : Bool #

Returns true when log would write a debug line.

Amber::Pipe::Logger.writes_debug?(::Log.for("request"))

[View source]

Instance Method Detail

def call(context : HTTP::Server::Context) #

Logs the request at debug level after the rest of the pipeline runs.

When no source would write a debug line (Amber's default info level), it passes the request on and allocates nothing: it does not read the clock, parse params, or build the session.


[View source]