| 1 |
<?php |
| 2 |
|
| 3 |
namespace Minify\Logger; |
| 4 |
|
| 5 |
use Monolog\Handler\AbstractProcessingHandler; |
| 6 |
|
| 7 |
class LegacyHandler extends AbstractProcessingHandler |
| 8 |
{ |
| 9 |
private $obj; |
| 10 |
|
| 11 |
public function __construct($obj) |
| 12 |
{ |
| 13 |
if (!is_callable(array($obj, 'log'))) { |
| 14 |
throw new \InvalidArgumentException('$obj must have a public log() method'); |
| 15 |
} |
| 16 |
$this->obj = $obj; |
| 17 |
parent::__construct(); |
| 18 |
} |
| 19 |
|
| 20 |
protected function write(array $record) |
| 21 |
{ |
| 22 |
$this->obj->log((string)$record['formatted']); |
| 23 |
} |
| 24 |
} |
| 25 |
|