public function log($level, $message, array $context = [])
{
// Check level defined
if (!in_array($level, static::$levels)) {
throw new InvalidArgumentException();
}
// Verify Exception
if (isset($context['exception'])) {
$exception = $context['exception'];
if (!$exception instanceof \Exception) {
$exception = new \Exception((string) $exception);
$context['exception'] = $exception;
}
}
$message = $this->interpolate($message, $context);
// Open stream
if (!isset($this->strerr)) {
$this->stderr = fopen('php://stderr', 'w');
}
fprintf($this->stderr, "[%s] %s\n", strtoupper($level), $message);
}