Skip to content

Commit

Permalink
Laravel 10 compatible processor configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
mvsvolkov committed Jan 29, 2024
1 parent 90c80b7 commit f75f5bb
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions src/GelfLoggerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ public function __invoke(array $config): Logger
)
);

foreach ($this->parseProcessors($config) as $processor) {
$handler->pushProcessor(new $processor);
foreach ($this->prepareProcessors($config) as $processor) {
$handler->pushProcessor($processor);
}

return new Logger($this->parseChannel($config), [$handler]);
Expand Down Expand Up @@ -125,17 +125,11 @@ protected function sslOptions(?array $sslConfig = null): SslOptions
return $sslOptions;
}

protected function parseProcessors(array $config): array
protected function prepareProcessors(array $config): array
{
$processors = [];

if (isset($config['processors']) && is_array($config['processors'])) {
foreach ($config['processors'] as $processor) {
$processors[] = $processor;
}
}

return $processors;
return collect($config['processors'] ?? [])
->map(fn ($processor) => $this->app->make($processor['processor'] ?? $processor, $processor['with'] ?? []))
->toArray();
}

protected function getFallbackChannelName(): string
Expand Down

0 comments on commit f75f5bb

Please sign in to comment.