Back out behaviour change in debug logging we don't want, keeping only the addition...
[catagits/Catalyst-Runtime.git] / lib / Catalyst.pm
index 1997c84..58c0505 100644 (file)
@@ -2108,8 +2108,6 @@ Writes information about the request to the debug logs.  This includes:
 
 =item * Request method, path, and remote IP address
 
-=item * Request headers (see L</log_headers>)
-
 =item * Query keywords (see L<Catalyst::Request/query_keywords>)
 
 =item * Request parameters
@@ -2134,7 +2132,7 @@ sub log_request {
     $address ||= '';
     $c->log->debug(qq/"$method" request for "$path" from "$address"/);
 
-    $c->log_headers('request', $request->headers);
+    $c->log_request_headers($request->headers);
 
     if ( my $keywords = $request->query_keywords ) {
         $c->log->debug("Query keywords are: $keywords");
@@ -2153,7 +2151,9 @@ Writes information about the response to the debug logs.  This includes:
 
 =item * Response status code
 
-=item * Response headers (see L</log_headers>)
+=item * Content-Type header (if present)
+
+=item * Content-Length header (if present)
 
 =back
 
@@ -2167,14 +2167,14 @@ sub log_response {
     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',
-                       $response->status                            || 'unknown',
-                       $response->headers->header('Content-Type')   || 'unknown',
-                       $response->headers->header('Content-Length') || 'unknown'
-               )
-       );
+    $c->log->debug(
+        sprintf(
+            'Response Code: %s; Content-Type: %s; Content-Length: %s',
+            $response->status                            || 'unknown',
+            $response->headers->header('Content-Type')   || 'unknown',
+            $response->headers->header('Content-Length') || 'unknown'
+        )
+    );
 }
 
 =head2 $c->log_request_parameters( query => {}, body => {} )
@@ -2233,6 +2233,15 @@ sub log_request_uploads {
     }
 }
 
+=head2 $c->log_request_headers($headers);
+
+Hook method which can be wrapped by plugins to log the request headers.
+No-op in the default implementation.
+
+=cut
+
+sub log_request_headers {}
+
 =head2 $c->log_headers($type => $headers)
 
 Logs L<HTTP::Headers> (either request or response) to the debug logs.