Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Tim Lieberman
PHP Stack Logger
Commits
d67551ea
Commit
d67551ea
authored
Aug 25, 2021
by
Tim Lieberman
Browse files
rename getNullLogger to makeNullLogger. Narrow return type of MonologStackLogger::getWrapped
parent
4e427789
Pipeline
#42
passed with stage
in 42 seconds
Changes
4
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
src/MonologStackLogger.php
View file @
d67551ea
...
...
@@ -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
get
NullLogger
():
self
public
static
function
make
NullLogger
():
self
{
return
new
self
(
new
MonologLogger
(
'null'
,
[
new
NullHandler
()]));
}
public
function
getWrapped
():
MonologLogger
{
return
parent
::
getWrapped
();
}
}
src/Psr3StackLogger.php
View file @
d67551ea
...
...
@@ -143,7 +143,7 @@ class Psr3StackLogger implements StackLogger
$this
->
log
(
LogLevel
::
DEBUG
,
$message
,
$context
);
}
public
static
function
get
NullLogger
():
self
public
static
function
make
NullLogger
():
self
{
return
new
self
(
new
\
Psr\Log\NullLogger
());
}
...
...
src/StackLogger.php
View file @
d67551ea
...
...
@@ -26,5 +26,5 @@ interface StackLogger extends LoggerInterface
*/
public
function
addContext
(
array
$context
):
static
;
public
static
function
get
NullLogger
():
self
;
public
static
function
make
NullLogger
():
self
;
}
tests/BaseTest.php
View file @
d67551ea
...
...
@@ -153,7 +153,7 @@ abstract class BaseTest extends TestCase
public
function
testNullLoggerFactory
():
void
{
$null
=
$this
->
log
::
get
NullLogger
();
$null
=
$this
->
log
::
make
NullLogger
();
$this
->
assertInstanceOf
(
StackLogger
::
class
,
$null
);
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment