adding interpolation as requested by PSR-3

This commit is contained in:
Thomas Müller 2014-05-12 10:54:09 +02:00
parent b4298c68ca
commit d853c60d7e
1 changed files with 9 additions and 0 deletions

View File

@ -144,6 +144,15 @@ class Log implements ILogger {
} else {
$app = 'no app in context';
}
// interpolate $message as defined in PSR-3
$replace = array();
foreach ($context as $key => $val) {
$replace['{' . $key . '}'] = $val;
}
// interpolate replacement values into the message and return
$message = strtr($message, $replace);
$logger=$this->logger;
$logger::write($app, $message, $level);
}