poolcounter: Convert slow-parse to LoggerFactory with data context
authorTimo Tijhof <krinklemail@gmail.com>
Wed, 26 Aug 2015 18:41:03 +0000 (20:41 +0200)
committerTimo Tijhof <krinklemail@gmail.com>
Wed, 26 Aug 2015 18:41:13 +0000 (20:41 +0200)
This way the time and title values are transmitted via Monolog
as separate JSON properties.

Keep the message the same for backwards-compatibility (except
for the space padding).

Change-Id: I0b79944bb9944dc6d09d16fe2ecc845e0e0e2afb

includes/poolcounter/PoolWorkArticleView.php

index a702d2e..d601467 100644 (file)
@@ -142,8 +142,12 @@ class PoolWorkArticleView extends PoolCounterWork {
 
                // Timing hack
                if ( $time > 3 ) {
-                       wfDebugLog( 'slow-parse', sprintf( "%-5.2f %s", $time,
-                               $this->page->getTitle()->getPrefixedDBkey() ) );
+                       // TODO: Use Parser's logger (once it has one)
+                       $logger = MediaWiki\Logger\LoggerFactory::getInstance( 'slow-parse' );
+                       $logger->info( '{time} {title}', array(
+                               'time' => number_format( $time, 2 ),
+                               'title' => $this->page->getTitle()->getPrefixedDBkey(),
+                       ) );
                }
 
                if ( $this->cacheable && $this->parserOutput->isCacheable() && $isCurrent ) {