From 422973292a6157345ffaa0ffdad1eac7cec0df54 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Thu, 22 Jun 2017 14:08:05 -0700 Subject: [PATCH] Paramaterize TransactionProfiler log entries Change-Id: I4e468d818af48dba21cd2c567f4e6a58beb0924b --- includes/libs/rdbms/TransactionProfiler.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/includes/libs/rdbms/TransactionProfiler.php b/includes/libs/rdbms/TransactionProfiler.php index 256f744d32..43b6f88704 100644 --- a/includes/libs/rdbms/TransactionProfiler.php +++ b/includes/libs/rdbms/TransactionProfiler.php @@ -329,20 +329,23 @@ class TransactionProfiler implements LoggerAwareInterface { /** * @param string $expect * @param string $query - * @param string|float|int $actual [optional] + * @param string|float|int $actual */ - protected function reportExpectationViolated( $expect, $query, $actual = null ) { + protected function reportExpectationViolated( $expect, $query, $actual ) { if ( $this->silenced ) { return; } - $n = $this->expect[$expect]; - $by = $this->expectBy[$expect]; - $actual = ( $actual !== null ) ? " (actual: $actual)" : ""; - $this->logger->info( - "Expectation ($expect <= $n) by $by not met$actual:\n$query\n" . - ( new RuntimeException() )->getTraceAsString() + "Expectation ({measure} <= {max}) by {by} not met (actual: {actual}):\n{query}\n" . + ( new RuntimeException() )->getTraceAsString(), + [ + 'measure' => $expect, + 'max' => $this->expect[$expect], + 'by' => $this->expectBy[$expect], + 'actual' => $actual, + 'query' => $query + ] ); } } -- 2.20.1