public function testCreateHandlerWithFormatter()
 {
     $handlerOptions = new MonologHandlerOptions(array('handlerClass' => 'Monolog\\Handler\\ErrorLogHandler', 'args' => array(), 'formatter' => array('formatterClass' => 'Monolog\\Formatter\\LineFormatter', 'args' => array("%message%"))));
     $factory = new MonologHandlerFactory();
     $handler = $factory->createHandler($handlerOptions);
     $this->assertInstanceOf('Monolog\\Handler\\ErrorLogHandler', $handler);
 }
 public function createLogger(MonologLoggerOptions $options, ServiceLocatorInterface $serviceLocator)
 {
     $log = new Logger($options->getName());
     foreach ($options->getHandlers() as $handlerOptions) {
         if ($handlerOptions instanceof MonologHandlerOptions) {
             /** @var HandlerInterface $handler */
             $handler = $this->handlerFactory->createHandler($handlerOptions);
         } elseif (is_string($handlerOptions) && $serviceLocator->has($handlerOptions)) {
             /** @var HandlerInterface $handler */
             $handler = $serviceLocator->get($handlerOptions);
         } else {
             throw new \Exception('Invalid Handler Not Found');
         }
         $log->pushHandler($handler);
     }
     return $log;
 }