Skip to content

Commit

Permalink
Update the StdOutLogger to use Psr the LoggerTrait
Browse files Browse the repository at this point in the history
  • Loading branch information
Hectorhammett committed Nov 11, 2024
1 parent 202890d commit a57a184
Showing 1 changed file with 3 additions and 64 deletions.
67 changes: 3 additions & 64 deletions src/Logging/StdOutLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

use InvalidArgumentException;
use Psr\Log\LoggerInterface;
use Psr\Log\LoggerTrait;
use Psr\Log\LogLevel;
use Stringable;

Expand All @@ -27,6 +28,8 @@
*/
class StdOutLogger implements LoggerInterface
{
use LoggerTrait;

/**
* @var array<string,int>
*/
Expand All @@ -52,70 +55,6 @@ public function __construct(string $level = LogLevel::DEBUG)
$this->level = $this->getLevelMap($level);
}

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

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

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

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

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

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

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

/**
* {@inheritdoc}
*/
public function debug(string|Stringable $message, array $context = []): void
{
$this->log(LogLevel::DEBUG, $message);
}

/**
* {@inheritdoc}
*/
Expand Down

0 comments on commit a57a184

Please sign in to comment.