Dynamic log level on LookupException

This commit is contained in:
2021-09-13 23:47:45 +03:00
parent 6428a1ec33
commit 3c7686405d
2 changed files with 10 additions and 1 deletions

View File

@@ -4,6 +4,15 @@ declare(strict_types=1);
namespace Nsq\Exception;
use Psr\Log\LogLevel;
final class LookupException extends NsqException
{
public function level(): string
{
return match ($this->getMessage()) {
'TOPIC_NOT_FOUND' => LogLevel::DEBUG,
default => LogLevel::WARNING,
};
}
}