class
Amber::Pipe::Logger
- Amber::Pipe::Logger
- Amber::Pipe::Base
- Reference
- Object
Defined in:
amber/pipes/logger.crConstant 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
-
.new(filter : Array(String) = log_config.filter, skip : Array(String) = log_config.skip, colorize : Bool = log_config.colorize)
Reads
Amber.settingsonly when the pipe is built, which happens inconfig/routes.crafter the app's initializers have registered their settings sections.
Class Method Summary
-
.writes_debug?(log : Log) : Bool
Returns
truewhen log would write a debug line.
Instance Method Summary
-
#call(context : HTTP::Server::Context)
Logs the request at debug level after the rest of the pipeline runs.
Instance methods inherited from class Amber::Pipe::Base
call(context : HTTP::Server::Context)
call
Constructor Detail
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.
Class Method Detail
Returns true when log would write a debug line.
Amber::Pipe::Logger.writes_debug?(::Log.for("request"))
Instance Method Detail
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.