Commit d67551ea authored by Tim Lieberman's avatar Tim Lieberman
Browse files

rename getNullLogger to makeNullLogger. Narrow return type of MonologStackLogger::getWrapped

parent 4e427789
Pipeline #42 passed with stage
in 42 seconds
......@@ -6,6 +6,7 @@ namespace TimDev\StackLogger;
use Monolog\Handler\NullHandler;
use Monolog\Logger as MonologLogger;
use Psr\Log\LoggerInterface as PsrInterface;
/**
* Extends Psr3Logger to provide a monolog-like withName() method.
......@@ -29,8 +30,13 @@ class MonologStackLogger extends Psr3StackLogger
return $new;
}
public static function getNullLogger(): self
public static function makeNullLogger(): self
{
return new self(new MonologLogger('null', [new NullHandler()]));
}
public function getWrapped(): MonologLogger
{
return parent::getWrapped();
}
}
......@@ -143,7 +143,7 @@ class Psr3StackLogger implements StackLogger
$this->log(LogLevel::DEBUG, $message, $context);
}
public static function getNullLogger(): self
public static function makeNullLogger(): self
{
return new self(new \Psr\Log\NullLogger());
}
......
......@@ -26,5 +26,5 @@ interface StackLogger extends LoggerInterface
*/
public function addContext(array $context): static;
public static function getNullLogger(): self;
public static function makeNullLogger(): self;
}
......@@ -153,7 +153,7 @@ abstract class BaseTest extends TestCase
public function testNullLoggerFactory(): void
{
$null = $this->log::getNullLogger();
$null = $this->log::makeNullLogger();
$this->assertInstanceOf(StackLogger::class, $null);
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment