summaryrefslogtreecommitdiffstats
path: root/vendor/gipfl/log/src/AdditionalContextLogger.php
blob: 92891c5ad2515ac6bade1522f7497ec24bea1db3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php

namespace gipfl\Log;

use Psr\Log\LoggerInterface;

class AdditionalContextLogger extends Logger
{
    /** @var array */
    protected $context;

    /** @var LoggerInterface */
    protected $wrappedLogger;

    public function __construct(array $context, LoggerInterface $logger)
    {
        $this->context = $context;
        $this->wrappedLogger = $logger;
    }

    public function log($level, $message, array $context = [])
    {
        $this->wrappedLogger->log($level, $message, $context + $this->context);
    }
}