Skip to content

Instantly share code, notes, and snippets.

@simonbowen
Created May 1, 2013 10:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simonbowen/5494584 to your computer and use it in GitHub Desktop.
Save simonbowen/5494584 to your computer and use it in GitHub Desktop.
public function format_message(array $message, $format = "time --- level: body in file:line")
{
$message['time'] = Date::formatted_time('@'.$message['time'], Log_Writer::$timestamp, Log_Writer::$timezone, TRUE);
$message['level'] = $this->_log_levels[$message['level']];
$string = strtr($format, array_filter($message, 'is_scalar'));
if (isset($message['additional']['exception']))
{
// Re-use as much as possible, just resetting the body to the trace
$message['body'] = $message['additional']['exception']->getTraceAsString();
$message['level'] = $this->_log_levels[Log_Writer::$strace_level];
$string .= PHP_EOL.strtr($format, array_filter($message, 'is_scalar'));
}
return $string;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment