[Catalyst-commits] r13086 - in Catalyst-Runtime/5.80/trunk: . lib
t0m at dev.catalyst.perl.org
t0m at dev.catalyst.perl.org
Sun Mar 28 18:18:45 GMT 2010
Author: t0m
Date: 2010-03-28 19:18:45 +0100 (Sun, 28 Mar 2010)
New Revision: 13086
Modified:
Catalyst-Runtime/5.80/trunk/Changes
Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm
Log:
More splitting up of the response logging methods
Modified: Catalyst-Runtime/5.80/trunk/Changes
===================================================================
--- Catalyst-Runtime/5.80/trunk/Changes 2010-03-28 17:24:18 UTC (rev 13085)
+++ Catalyst-Runtime/5.80/trunk/Changes 2010-03-28 18:18:45 UTC (rev 13086)
@@ -6,9 +6,10 @@
Refactoring / optimizations:
- Display of the end of hit debug messages has been factored out into
- log_headers, log_request, log_request_headers, log_response and
- log_response_headers methods so that plugins which customise how
- much information is shown on the debug screen as easy to write.
+ log_headers, log_request, log_request_headers, log_response,
+ log_response_status_line and log_response_headers methods so that
+ plugins which customise how much information is shown on the debug
+ screen as easy to write.
- Make all logging of request and response state get the information from
$c->dump_these so that there is a unified point from which to hook
in parameter filtering (for example).
Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm 2010-03-28 17:24:18 UTC (rev 13085)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm 2010-03-28 18:18:45 UTC (rev 13086)
@@ -2145,8 +2145,27 @@
=head2 $c->log_response
-Writes information about the response to the debug logs. This includes:
+Writes information about the response to the debug logs by calling
+C<< $c->log_response_status_line >> and C<< $c->log_response_headers >>.
+=cut
+
+sub log_response {
+ my $c = shift;
+
+ return unless $c->debug;
+
+ my($dump) = grep {$_->[0] eq 'Response' } $c->dump_these;
+ my $response = $dump->[1];
+
+ $c->log_response_status_line($response);
+ $c->log_response_headers($response->headers);
+}
+
+=head2 $c->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
@@ -2159,14 +2178,9 @@
=cut
-sub log_response {
- my $c = shift;
+sub log_response_status_line {
+ my ($c, $response) = @_;
- return unless $c->debug;
-
- my($dump) = grep {$_->[0] eq 'Response' } $c->dump_these;
- my $response = $dump->[1];
-
$c->log->debug(
sprintf(
'Response Code: %s; Content-Type: %s; Content-Length: %s',
@@ -2177,6 +2191,15 @@
);
}
+=head2 $c->log_response_headers($headers);
+
+Hook method which can be wrapped by plugins to log the responseheaders.
+No-op in the default implementation.
+
+=cut
+
+sub log_response_headers {}
+
=head2 $c->log_request_parameters( query => {}, body => {} )
Logs request parameters to debug logs
More information about the Catalyst-commits
mailing list