Skip to content

Commit f44bb19

Browse files
committed
Allow the logger to be null (as per every other bits in the FrameworkBundle)
1 parent 0c7d2ef commit f44bb19

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Debug/LoggingMiddleware.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class LoggingMiddleware implements MiddlewareInterface
2121
{
2222
private $logger;
2323

24-
public function __construct(LoggerInterface $logger)
24+
public function __construct(LoggerInterface $logger = null)
2525
{
2626
$this->logger = $logger;
2727
}
@@ -31,6 +31,10 @@ public function __construct(LoggerInterface $logger)
3131
*/
3232
public function handle($message, callable $next)
3333
{
34+
if (null === $this->logger) {
35+
return $next($message);
36+
}
37+
3438
$this->logger->debug('Starting handling message {class}', array(
3539
'message' => $message,
3640
'class' => get_class($message),

0 commit comments

Comments
 (0)