Do not require that a Monolog handler has a formatter
authorBryan Davis <bd808@wikimedia.org>
Fri, 12 Dec 2014 20:29:35 +0000 (13:29 -0700)
committerBryan Davis <bd808@wikimedia.org>
Fri, 12 Dec 2014 20:29:35 +0000 (13:29 -0700)
Not all handlers require a formatter.

Change-Id: Ifb31aa278d4e90b7fa3a2b7bf3b20173b8345afd

includes/debug/logger/monolog/Spi.php

index c43e3d6..4ad5687 100644 (file)
@@ -218,7 +218,11 @@ class MWLoggerMonologSpi implements MWLoggerSpi {
                if ( !isset( $this->singletons['handlers'][$name] ) ) {
                        $spec = $this->config['handlers'][$name];
                        $handler = ObjectFactory::getObjectFromSpec( $spec );
-                       $handler->setFormatter( $this->getFormatter( $spec['formatter'] ) );
+                       if ( isset( $spec['formatter'] ) ) {
+                               $handler->setFormatter(
+                                       $this->getFormatter( $spec['formatter'] )
+                               );
+                       }
                        $this->singletons['handlers'][$name] = $handler;
                }
                return $this->singletons['handlers'][$name];