summaryrefslogtreecommitdiffstats
path: root/vendor/gipfl/log/src/PrefixLogger.php
blob: a7273a2b82331e748dfeb33c9f4fb5cdaf4de856 (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 PrefixLogger extends Logger
{
    /** @var string */
    protected $prefix;

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

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

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