Nikolay Martynov
and 1 contributors

NAME

Plack::Middleware::Timed::Logger - Expose a Timed::Logger Instance in Middleware

VERSION

Version 0.0.5

SYNOPSIS

    use Plack::Builder;
    builder {
      enable 'Timed::Logger';
      $app;
    };

DESCRIPTION

Plack::Middleware::Timed::Logger does one thing, it places an instance of Timed::Logger into the $env under plack.middleware.timed.logger. A new instance is created for each incoming request.

This middleware is intended to act as a bridge between Timed::Logger, which holds log of the events, with a reporting tool such as seen in Plack::Middleware::Debug::Timed::Logger.

Unless you are building some custom logging tools, you probably just want to use the existing debug panel (Plack::Middleware::Debug::Timed::Logger) rather than building something custom around this middleware.

If you are using Dancer to build your web application you may want to use Timed::Logger::Dancer::AdoptPlack to help you to bridge Dancer's conrollers with this middleware.

This module was inspired by Plack::Middleware::DBIC::QueryLog.

SUBROUTINES

This middleware defines the following public subroutines

PSGI_KEY

Returns the PSGI $env key under which you'd expect to find an instance of Timed::Logger.

get_logger_from_env

Given a Plack $env, returns a Timed::Logger. You should use this in your code that is trying to access the logger. For example:

    use Plack::Middleware::Timed::Logger;

    sub logger {
      my ($self, $env) = @_;
      Plack::Middleware::Timed::Logger->get_logger_from_env($env);
    }

This function creates a new instance of Timed::Logger if one doesn't exist already. This is the officially supported interface for extracting a Timed::Logger from a Plack request.

call

An callback used by Plack to call this middleware.

SEE ALSO

Timed::Logger, Plack::Middleware::Debug::Timed::Logger, Timed::Logger::Dancer::AdoptPlack

AUTHOR

Nikolay Martynov, <kolya at cpan.org>

BUGS

Please report any bugs or feature requests to bug-plack-middleware-timed-logger at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Plack-Middleware-Timed-Logger. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Plack::Middleware::Timed::Logger

You can also look for information at:

ACKNOWLEDGEMENTS

Logan Bell and Belden Lyman.

LICENSE AND COPYRIGHT

Copyright 2013 Nikolay Martynov and Shutterstock Inc (http://shutterstock.com). All rights reserved.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.