| @@ 67-81 (lines=15) @@ | ||
| 64 | * |
|
| 65 | * @return \Monolog\Handler\HandlerInterface The handler instance |
|
| 66 | */ |
|
| 67 | public function factory(HandlerConfigurationInterface $handlerConfiguration) |
|
| 68 | { |
|
| 69 | ||
| 70 | // load the params |
|
| 71 | $params = $handlerConfiguration->getParams(); |
|
| 72 | ||
| 73 | // set the default log level, if not already set explicitly |
|
| 74 | if (!isset($params[ConfigurationKeys::LEVEL])) { |
|
| 75 | $params[ConfigurationKeys::LEVEL] = $this->defaultLogLevel; |
|
| 76 | } |
|
| 77 | ||
| 78 | // create and return the handler instance |
|
| 79 | $reflectionClass = new \ReflectionClass(ErrorLogHandler::class); |
|
| 80 | return $reflectionClass->newInstanceArgs(ConfigurationUtil::prepareConstructorArgs($reflectionClass, $params)); |
|
| 81 | } |
|
| 82 | } |
|
| 83 | ||
| @@ 73-87 (lines=15) @@ | ||
| 70 | * |
|
| 71 | * @return \Monolog\Handler\HandlerInterface The handler instance |
|
| 72 | */ |
|
| 73 | public function factory(HandlerConfigurationInterface $handlerConfiguration) |
|
| 74 | { |
|
| 75 | ||
| 76 | // load the params |
|
| 77 | $params = $handlerConfiguration->getParams(); |
|
| 78 | ||
| 79 | // set the default log level, if not already set explicitly |
|
| 80 | if (!isset($params[ConfigurationKeys::LEVEL])) { |
|
| 81 | $params[ConfigurationKeys::LEVEL] = $this->defaultLogLevel; |
|
| 82 | } |
|
| 83 | ||
| 84 | // create and return the handler instance |
|
| 85 | $reflectionClass = new \ReflectionClass($this->handlerClassName); |
|
| 86 | return $reflectionClass->newInstanceArgs(ConfigurationUtil::prepareConstructorArgs($reflectionClass, $params)); |
|
| 87 | } |
|
| 88 | } |
|
| 89 | ||