Exemplo n.º 1
0
 /**
  * @param array $loggerConfig
  *
  * @return array
  *
  * @throws MonologCreator\Exception
  */
 public function createHandlers(array $loggerConfig)
 {
     $handlers = array();
     $formatterFactory = new MonologCreator\Factory\Formatter($this->_config);
     $handlerFactory = new MonologCreator\Factory\Handler($this->_config, $this->_levels, $formatterFactory);
     foreach ($loggerConfig['handler'] as $handlerType) {
         $handlers[] = $handlerFactory->create($handlerType, $loggerConfig['level']);
     }
     return $handlers;
 }
Exemplo n.º 2
0
 /**
  * @expectedException \MonologCreator\Exception
  * @expectedExceptionMessage key configuration for redis handler is missing
  */
 public function testCreateRedisFailNoKey()
 {
     $config = json_decode('{
             "handler" : {
                 "redis" : {
                     "url" : "mockUrl"
                 }
             }
         }', true);
     $factory = new Handler($config, array(), $this->_mockFormatterFactory);
     $factory->create('redis', 'INFO');
 }