Merge branch 'rrwo/log_stats_report'
Graham Knop [Tue, 27 Nov 2018 15:21:11 +0000 (16:21 +0100)]
Changes
lib/Catalyst.pm
lib/Catalyst/Upgrading.pod

diff --git a/Changes b/Changes
index c9534ca..4b488be 100644 (file)
--- a/Changes
+++ b/Changes
@@ -2,6 +2,7 @@
 
   - Fix emitting warnings when REMOTE_ADDR is undefined (RT#113388)
   - Fix $c->req->hostname empty for IPv6 clients (RT#75731)
+  - split code to log stats report into a separate log_stats method (RT#127392)
 
 5.90122 - 2018-11-03
   - releasing as stable
index 2258ae8..a2274f1 100644 (file)
@@ -2196,16 +2196,27 @@ sub finalize {
 
     $c->log_response;
 
-    if ($c->use_stats) {
-        my $elapsed = $c->stats->elapsed;
-        my $av = $elapsed == 0 ? '??' : sprintf '%.3f', 1 / $elapsed;
-        $c->log->info(
-            "Request took ${elapsed}s ($av/s)\n" . $c->stats->report . "\n" );
-    }
+    $c->log_stats if $c->use_stats;
 
     return $c->response->status;
 }
 
+=head2 $c->log_stats
+
+Logs statistics.
+
+=cut
+
+sub log_stats {
+    my $c = shift;
+
+    my $elapsed = $c->stats->elapsed;
+    my $av = $elapsed == 0 ? '??' : sprintf '%.3f', 1 / $elapsed;
+    $c->log->info(
+        "Request took ${elapsed}s ($av/s)\n" . $c->stats->report . "\n" );
+}
+
+
 =head2 $c->finalize_body
 
 Finalizes body.
@@ -5011,6 +5022,8 @@ revmischa: Mischa Spiegelmock <revmischa@cpan.org>
 
 Robert Sedlacek <rs@474.at>
 
+rrwo: Robert Rothenberg <rrwo@cpan.org>
+
 SpiceMan: Marcel Montes
 
 sky: Arthur Bergman
index 907b309..c0a3533 100644 (file)
@@ -2,6 +2,11 @@
 
 Catalyst::Upgrading - Instructions for upgrading to the latest Catalyst
 
+=head1 Upgrading to Catalyst 5.90121
+
+A new C<log_stats> method has been added. This will only affect
+subclasses that have a method with this name added.
+
 =head1 Upgrading to Catalyst 5.90100
 
 We changed the way the middleware stash works so that it no longer localizes