Plack-Middleware-DebugLogging
view release on metacpan or search on metacpan
lib/Plack/Middleware/DebugLogging.pm view on Meta::CPAN
This is a refactoring/stealing of Catalyst's useful debugging output for use in
any Plack application, sitting infront of a web framework or otherwise. This is
ideal for development environments. You probably would not want to run this on
your production application.
One new feature that differentiates from Catalyst is that if serialized content
is sent via body param, an attempt will be made to deserialize based on the
Content-Type header with Data::Serializer.
This middleware will use psgix.logger if available in the environment,
otherwise it will fall back to printing to stderr.
There are a large list of attrs which can be used to control which
output you want to see:
=over 4
=item debug
=item request
=item response
=item request_headers
=item request_parameters
=item response_headers
=item response_status_line
=item keywords
=item uploads
=item body_params
=item query_params
=item attempt_deserialize
=item serializer
=back
=head1 NAME
Plack::Middleware::DebugLogging - Catalyst style console debugging for plack apps
=head1 METHODS
=head2 $self->log_request
Writes information about the request to the debug logs. This includes:
=over 4
=item * Request method, path, and remote IP address
=item * Query keywords (see L<Catalyst::Request/query_keywords>)
=item * Request parameters
=item * File uploads
=back
=head2 $self->log_response
Writes information about the response to the debug logs by calling
C<< $self->log_response_status_line >> and C<< $self->log_response_headers >>.
=head2 $self->log_response_status_line($response)
Writes one line of information about the response to the debug logs. This includes:
=over 4
=item * Response status code
=item * Content-Type header (if present)
=item * Content-Length header (if present)
=back
=head2 $self->log_request_parameters( query => {}, body => {} )
Logs request parameters to debug logs
=head2 $self->log_request_uploads
Logs file uploads included in the request to the debug logs.
The parameter name, filename, file type, and file size are all included in
the debug logs.
=head2 $self->log_headers($type => $headers)
Logs L<HTTP::Headers> (either request or response) to the debug logs.
=head1 AUTHOR
Matthew Phillips <mattp@cpan.org>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2015 by Matthew Phillips <mattp@cpan.org>.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
( run in 1.123 second using v1.01-cache-2.11-cpan-5b529ec07f3 )