Skip to content

Commit

Permalink
Allow explorer to accept logger to accept channel name
Browse files Browse the repository at this point in the history
  • Loading branch information
maikelmotivo committed Nov 27, 2023
1 parent bd1066a commit a06aa56
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/Infrastructure/Elastic/ElasticClientBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Elasticsearch\ClientBuilder;
use Illuminate\Contracts\Config\Repository;
use Illuminate\Support\Facades\Log;

final class ElasticClientBuilder
{
Expand Down Expand Up @@ -64,8 +65,14 @@ public static function fromConfig(Repository $config): ClientBuilder
$builder->setSSLCert($path, $password);
}

if($config->get('explorer.logging', false) && $config->has('explorer.logger')) {
$builder->setLogger($config->get('explorer.logger'));
if($config->get('explorer.logging', false) && $config->get('explorer.logger')) {
$logger = $config->get('explorer.logger');

if(is_string($logger)) {
$logger = Log::channel($logger);
}

$builder->setLogger($logger);
}

return $builder;
Expand Down

0 comments on commit a06aa56

Please sign in to comment.