本文整理匯總了PHP中s::getTrace方法的典型用法代碼示例。如果您正苦於以下問題:PHP s::getTrace方法的具體用法?PHP s::getTrace怎麽用?PHP s::getTrace使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類s
的用法示例。
在下文中一共展示了s::getTrace方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: handle_exception
/**
* Handle uncaught exceptions
*
* @param s $exception
* @return void
*/
public function handle_exception($exception)
{
// Build tracelist
$trace = $exception->getTrace();
foreach ($trace as $key => $stackPoint) {
// I'm converting arguments to their type
// (prevents passwords from ever getting logged as anything other than 'string')
$trace[$key]['args'] = array_map('gettype', $trace[$key]['args']);
}
$result = array();
foreach ($trace as $key => $stackPoint) {
$result[] = sprintf($traceline, $key, $stackPoint['file'], $stackPoint['line'], $stackPoint['function'], implode(', ', $stackPoint['args']));
}
print_r($result);
$data['%message%'] = $exception->getMessage();
$data['%file%'] = $exception->getFile();
$data['%line%'] = $exception->getLine();
$data['%type%'] = 'Exception';
$line = $this->prepare_line($data);
$this->send($line);
}