summaryrefslogtreecommitdiffstats
path: root/admin/survey/minify/lib/Minify/Logger/LegacyHandler.php
blob: fe4800f3bc780fd193e273c2a280e3c27c25301c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php

namespace Minify\Logger;

use Monolog\Handler\AbstractProcessingHandler;

class LegacyHandler extends AbstractProcessingHandler
{
    private $obj;

    public function __construct($obj)
    {
        if (!is_callable(array($obj, 'log'))) {
            throw new \InvalidArgumentException('$obj must have a public log() method');
        }
        $this->obj = $obj;
        parent::__construct();
    }

    protected function write(array $record)
    {
        $this->obj->log((string)$record['formatted']);
    }
}