Merge "RequestContext: Load the request object for getRequest on first call"
[lhc/web/wiklou.git] / includes / context / RequestContext.php
index 8c13e97..36c644a 100644 (file)
@@ -22,6 +22,8 @@
  * @file
  */
 
+use MediaWiki\Logger\LoggerFactory;
+
 /**
  * Group all the pieces relevant to the context of a request into one instance
  */
@@ -140,10 +142,7 @@ class RequestContext implements IContextSource, MutableContext {
         */
        public function getStats() {
                if ( $this->stats === null ) {
-                       $config = $this->getConfig();
-                       $prefix = $config->get( 'StatsdMetricPrefix' )
-                               ? rtrim( $config->get( 'StatsdMetricPrefix' ), '.' )
-                               : 'MediaWiki';
+                       $prefix = rtrim( $this->getConfig()->get( 'StatsdMetricPrefix' ), '.' );
                        $this->stats = new BufferingStatsdDataFactory( $prefix );
                }
                return $this->stats;
@@ -156,7 +155,9 @@ class RequestContext implements IContextSource, MutableContext {
         */
        public function getTiming() {
                if ( $this->timing === null ) {
-                       $this->timing = new Timing();
+                       $this->timing = new Timing( array(
+                               'logger' => LoggerFactory::getInstance( 'Timing' )
+                       ) );
                }
                return $this->timing;
        }