protected function write(array $record)
{
switch ($record['level']) {
case Logger::EMERGENCY:
case Logger::ALERT:
case Logger::CRITICAL:
case Logger::ERROR:
$context = Notification::CONTEXT_ERROR;
break;
case Logger::WARNING:
$context = Notification::CONTEXT_WARNING;
break;
default:
$context = Notification::CONTEXT_INFO;
break;
}
$message = $record['level_name'] . ': ' . htmlentities($record['message']);
$notification = new Notification($message);
$notification->context = $context;
$notification->flags = 0;
try {
Manager::notify(Common::getRandomString(), $notification);
} catch (Zend_Session_Exception $e) {
// Can happen if this handler is enabled in CLI
// Silently ignore the error.
}
}