| @@ 12-32 (lines=21) @@ | ||
| 9 | use WShafer\PSR11MonoLog\HandlerManagerTrait; |
|
| 10 | use WShafer\PSR11MonoLog\FactoryInterface; |
|
| 11 | ||
| 12 | class BufferHandlerFactory implements FactoryInterface, HandlerManagerAwareInterface |
|
| 13 | { |
|
| 14 | use HandlerManagerTrait; |
|
| 15 | ||
| 16 | public function __invoke(array $options) |
|
| 17 | { |
|
| 18 | $handler = $this->getHandlerManager()->get($options['handler']); |
|
| 19 | $bufferLimit = (int) ($options['bufferLimit'] ?? 0); |
|
| 20 | $level = (int) ($options['level'] ?? Logger::DEBUG); |
|
| 21 | $bubble = (boolean) ($options['bubble'] ?? true); |
|
| 22 | $flushOnOverflow = (boolean) ($options['flushOnOverflow'] ?? true); |
|
| 23 | ||
| 24 | return new BufferHandler( |
|
| 25 | $handler, |
|
| 26 | $bufferLimit, |
|
| 27 | $level, |
|
| 28 | $bubble, |
|
| 29 | $flushOnOverflow |
|
| 30 | ); |
|
| 31 | } |
|
| 32 | } |
|
| 33 | ||
| @@ 12-32 (lines=21) @@ | ||
| 9 | use WShafer\PSR11MonoLog\HandlerManagerTrait; |
|
| 10 | use WShafer\PSR11MonoLog\FactoryInterface; |
|
| 11 | ||
| 12 | class DeduplicationHandlerFactory implements FactoryInterface, HandlerManagerAwareInterface |
|
| 13 | { |
|
| 14 | use HandlerManagerTrait; |
|
| 15 | ||
| 16 | public function __invoke(array $options) |
|
| 17 | { |
|
| 18 | $handler = $this->getHandlerManager()->get($options['handler']); |
|
| 19 | $deduplicationStore = $options['deduplicationStore'] ?? null; |
|
| 20 | $deduplicationLevel = (int) ($options['deduplicationLevel'] ?? Logger::ERROR); |
|
| 21 | $time = (int) ($options['time'] ?? 60); |
|
| 22 | $bubble = (boolean) ($options['bubble'] ?? true); |
|
| 23 | ||
| 24 | return new DeduplicationHandler( |
|
| 25 | $handler, |
|
| 26 | $deduplicationStore, |
|
| 27 | $deduplicationLevel, |
|
| 28 | $time, |
|
| 29 | $bubble |
|
| 30 | ); |
|
| 31 | } |
|
| 32 | } |
|
| 33 | ||