PSR-3 standard as code

Code
<?php

use Psr\Log\AbstractLogger;
use 
Psr\Log\LogLevel;

// abstract from composer package psr/log
class Logger extends AbstractLogger
{
    public function 
log($level$message, array $context = array())
    {
        
$msg = (new DateTime())->format(DateTime::ISO8601);
        
$msg .= sprintf(' [%s] %s'$level$message) . PHP_EOL;
        
        if (array() !== 
$context) {
            
$search array_keys($context);
            
array_walk($search, function(&$value$key) {
                
$value sprintf('{%s}'$value);
            });
            
$replace array_values($context);
        
            
$msg str_replace($search$replace$msg);
        }
        
        
// write log (usually into a file)
        
echo $msg;
    }
}

$log = new Logger();
$log->error('an error happened in {file}', array('file' => 'foo.php'));
$log->notice('{reason} happened, but I work anyway', array('reason' => 'stuff'));
$log->warning('There is something strange in {method}. Better take a look', array('method' => 'bar()'));
Result
2017-04-25T22:14:11+0200 [error] an error happened in foo.php
2017-04-25T22:14:11+0200 [notice] stuff happened, but I work anyway
2017-04-25T22:14:11+0200 [warning] There is something strange in bar(). Better take a look
Used Versions
PHP 7.1, Zend 3.0, Symfony 3.2, Laravel 5.2, PHPUnit 5.6, Doctrine 2.6