Skip to content

Commit

Permalink
Add implementing Psr\Log\LoggerInterface to LoggerAdapter.
Browse files Browse the repository at this point in the history
  • Loading branch information
ksucherek committed Dec 4, 2024
1 parent 6b16790 commit 7af00b3
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/Ouzo/Core/Logger/LoggerAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use Psr\Log\LoggerInterface;
use Psr\Log\LogLevel;

class LoggerAdapter
class LoggerAdapter implements LoggerInterface
{
private MessageFormatter $messageFormatter;
private ?ContextEnhancer $contextEnhancer;
Expand All @@ -33,49 +33,49 @@ public function __construct(
$this->minimalLevels = Arrays::getValue($loggerConfiguration, 'minimal_levels', []);
}

public function emergency(string $message, array $context = []): void
public function emergency($message, array $context = []): void
{
$this->log(LogLevel::EMERGENCY, $message, $context);
}

public function alert(string $message, array $context = []): void
public function alert($message, array $context = []): void
{
$this->log(LogLevel::ALERT, $message, $context);
}

public function critical(string $message, array $context = []): void
public function critical($message, array $context = []): void
{
$this->log(LogLevel::CRITICAL, $message, $context);
}

public function error(string $message, array $context = []): void
public function error($message, array $context = []): void
{
$this->log(LogLevel::ERROR, $message, $context);
}

public function warning(string $message, array $context = []): void
public function warning($message, array $context = []): void
{
$this->log(LogLevel::WARNING, $message, $context);
}

public function notice(string $message, array $context = []): void
public function notice($message, array $context = []): void
{
$this->log(LogLevel::NOTICE, $message, $context);
}

public function info(string $message, array $context = []): void
public function info($message, array $context = []): void
{
$this->log(LogLevel::INFO, $message, $context);
}

public function debug(string $message, array $context = []): void
public function debug($message, array $context = []): void
{
if ($this->isDebug()) {
$this->log(LogLevel::DEBUG, $message, $context);
}
}

public function log(string $level, $message, array $context = []): void
public function log($level, $message, array $context = []): void
{
$ouzoLevel = LogLevelTranslator::toSyslogLevel($level);
$minimalLevel = $this->minimalLevels ? Arrays::getValue($this->minimalLevels, $this->name, LOG_DEBUG) : LOG_DEBUG;
Expand Down

0 comments on commit 7af00b3

Please sign in to comment.