-
-
21 May 2018 19:18:58 UTC
- Distribution: Plack-Middleware-LogErrors
- Module version: 0.003
- Source (raw)
- Browse (raw)
- Changes
- Homepage
- How to Contribute
- Repository
- Issues (0)
- Testers (853 / 0 / 0)
- Kwalitee
Bus factor: 1- 96.43% Coverage
- License: perl_5
- Perl: v5.8.0
- Activity
24 month- Tools
- Download (30.58KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
NAME
Plack::Middleware::LogErrors - Map psgi.errors to psgix.logger or other logger
VERSION
version 0.003
SYNOPSIS
Using a logger you have already configured (using Log::Dispatch as an example):
use Log::Dispatch; my $logger = Log::Dispatch->new; $logger->add( Log::Dispatch::File->new(...) ); builder { enable 'LogDispatch', logger => $logger; enable 'LogErrors'; $app; }
Using an explicitly defined logger:
builder { enable 'LogErrors', logger => sub { my $args = shift; $logger->log(%$args); }; $app; }
DESCRIPTION
psgi.errors
defaults toSTDERR
in most backends, which results in content going somewhere unhelpful like the server console.This middleware simply remaps the
psgi.errors
stream to thepsgix.logger
stream, or an explicit logger that you provide.This is especially handy when used in combination with other middlewares such as Plack::Middleware::LogWarn (which diverts Perl warnings to
psgi.errors
); Plack::Middleware::HTTPExceptions (which diverts uncaught exceptions topsgi.errors
); and Plack::Middleware::AccessLog, which defaults topsgi.errors
when not passed a logger -- which is also automatically applied via plackup (so if you provided no--access-log
option indicating a filename,psgi.errors
is used).CONFIGURATION
logger
A code reference for logging messages, that conforms to the psgix.logger specification. If not provided,
psgix.logger
is used, or the application will generate an error at runtime if there is no such logger configured.SEE ALSO
PSGI::Extensions - the definition of
psgix.logger
"The Error Stream" in PSGI - the definition of
psgi.errors
Plack::Middleware::LogWarn - maps warnings to
psgi.errors
Plack::Middleware::HTTPExceptions - maps exceptions to
psgi.errors
Plack::Middleware::LogDispatch - use a Log::Dispatch logger for
psgix.logger
Plack::Middleware::Log4perl - use a Log::Log4perl logger for
psgix.logger
Plack::Middleware::SimpleLogger - essentially the opposite of this module!
SUPPORT
Bugs may be submitted through the RT bug tracker (or bug-Plack-Middleware-LogErrors@rt.cpan.org).
There is also a mailing list available for users of this distribution, at https://groups.google.com/forum/#!forum/psgi-plack.
There is also an irc channel available for users of this distribution, at
#plack
onirc.perl.org
.I am also usually active on irc, as 'ether' at
irc.perl.org
.AUTHOR
Karen Etheridge <ether@cpan.org>
COPYRIGHT AND LICENCE
This software is copyright (c) 2013 by Karen Etheridge.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
Module Install Instructions
To install Plack::Middleware::LogErrors, copy and paste the appropriate command in to your terminal.
cpanm Plack::Middleware::LogErrors
perl -MCPAN -e shell install Plack::Middleware::LogErrors
For more information on module installation, please visit the detailed CPAN module installation guide.