public function create($handlerType, $level)
    {
        if (false === array_key_exists('handler', $this->_config)) {
            throw new MonologCreator\Exception(
                'no handler configuration found'
            );
        }

        if (false === array_key_exists($handlerType, $this->_config['handler'])) {
            throw new MonologCreator\Exception(
                'no handler configuration found for handlerType: '
                . $handlerType
            );
        }

        $handler       = null;
        $handlerConfig = $this->_config['handler'][$handlerType];

        // evaluate handler
        if ('stream' === $handlerType) {
            $handler = $this->_createStreamhandler($handlerConfig, $level);
        } elseif ('udp' === $handlerType) {
            $handler = $this->_createUdphandler($handlerConfig, $level);
        } elseif ('redis' === $handlerType) {
            $handler = $this->_createRedisHandler($handlerConfig, $level);
        } else {
            throw new MonologCreator\Exception(
                'handler type: ' . $handlerType . ' is not supported'
            );
        }

        // set formatter
        if (true === array_key_exists('formatter', $handlerConfig)) {
            $handler->setFormatter(
                $this->_formatterFactory->create($handlerConfig['formatter'])
            );
        }

        return $handler;
    }
public function create($handlerType, $level)
    {
        if (false === array_key_exists('handler', $this->_config)) {
            throw new MonologCreator\Exception(
                'no handler configuration found'
            );
        }

        if (false === array_key_exists($handlerType, $this->_config['handler'])) {
            throw new MonologCreator\Exception(
                'no handler configuration found for handlerType: '
                . $handlerType
            );
        }

        $handler       = null;
        $handlerConfig = $this->_config['handler'][$handlerType];

        // evaluate handler
        if ('stream' === $handlerType) {
            $handler = $this->_createStreamhandler($handlerConfig, $level);
        } elseif ('udp' === $handlerType) {
            $handler = $this->_createUdphandler($handlerConfig, $level);
        } elseif ('redis' === $handlerType) {
            $handler = $this->_createRedisHandler($handlerConfig, $level);
        } else {
            throw new MonologCreator\Exception(
                'handler type: ' . $handlerType . ' is not supported'
            );
        }

        // set formatter
        if (true === array_key_exists('formatter', $handlerConfig)) {
            $handler->setFormatter(
                $this->_formatterFactory->create($handlerConfig['formatter'])
            );
        }

        return $handler;
    }
public function create ( $ handlerType , $ level ) { if ( false === array_key_exists ( 'handler' , $ this -> _config ) ) { throw new MonologCreator \ Exception ( 'no handler configuration found' ) ; } if ( false === array_key_exists ( $ handlerType , $ this -> _config [ 'handler' ] ) ) { throw new MonologCreator \ Exception ( 'no handler configuration found for handlerType: ' . $ handlerType ) ; } $ handler = null ; $ handlerConfig = $ this -> _config [ 'handler' ] [ $ handlerType ] ; // evaluate handler if ( 'stream' === $ handlerType ) { $ handler = $ this -> _createStreamhandler ( $ handlerConfig , $ level ) ; } elseif ( 'udp' === $ handlerType ) { $ handler = $ this -> _createUdphandler ( $ handlerConfig , $ level ) ; } elseif ( 'redis' === $ handlerType ) { $ handler = $ this -> _createRedisHandler ( $ handlerConfig , $ level ) ; } else { throw new MonologCreator \ Exception ( 'handler type: ' . $ handlerType . ' is not supported' ) ; } // set formatter if ( true === array_key_exists ( 'formatter' , $ handlerConfig ) ) { $ handler -> setFormatter ( $ this -> _formatterFactory -> create ( $ handlerConfig [ 'formatter' ] ) ) ; } return $ handler ; }
creates specific monolog handlers

@param string $handlerType
@param string $level

@return Monolog\Handler\HandlerInterface

@throws MonologCreator\Exception
creates specific monolog handlers