Skip to content

Commit 4c71daa

Browse files
ssal config added
1 parent 121befa commit 4c71daa

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/KafkaLogHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ protected function write(array $record): void
9090
topic: $this->topic,
9191
broker: $this->brokers
9292
);
93-
if (!empty($this->config['sasl_config'])) {
93+
if ($this->config['is_sasl_apply'] && !empty($this->config['sasl_config'])) {
9494
$kafka->withSasl(new Sasl(
9595
username: $this->config['sasl_config']['username'],
9696
password: $this->config['sasl_config']['password'],

src/KafkaLogger.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public static function getInstance(string $topicName, string $brokers, array $op
4343
*/
4444
public function __invoke(array $config): Logger
4545
{
46+
4647
$logger = new Logger('kafka');
4748
throw_if(empty($config['brokers']), new \Exception('Brokers is provided', ResponseAlias::HTTP_UNPROCESSABLE_ENTITY));
4849
throw_if($config['is_sasl_apply'] && empty($config['sasl_config']), new \Exception('SASL Configuration is required', ResponseAlias::HTTP_UNPROCESSABLE_ENTITY));
@@ -52,6 +53,7 @@ public function __invoke(array $config): Logger
5253
throw_if(empty($config['sasl_config']['mechanisms']), new \Exception('Auth Mechanisms is invalid', ResponseAlias::HTTP_UNPROCESSABLE_ENTITY));
5354
throw_if(empty($config['sasl_config']['security_protocol']), new \Exception('SecurityProtocol is invalid', ResponseAlias::HTTP_UNPROCESSABLE_ENTITY));
5455
}
56+
5557
$topic = $config['topic'];
5658
$brokers = $config['brokers'];
5759
$key = $config['key'] ?? config('app.name');

0 commit comments

Comments
 (0)