public function ___trackException(Exception $e, $severe = true, $text = null)
{
$config = $this->wire('config');
$log = $this->wire('log');
$msg = $e->getMessage();
if ($text !== null) {
if ($text === true) {
$text = $msg;
}
$severe ? $this->error($text) : $this->warning($text);
if (strpos($text, $msg) === false) {
$msg = "{$text} - {$msg}";
}
}
if (in_array('exceptions', $config->logs) && $log) {
$msg .= " (in " . str_replace($config->paths->root, '/', $e->getFile()) . " line " . $e->getLine() . ")";
$log->save('exceptions', $msg);
}
if ($severe && $this->wire('config')->allowExceptions) {
throw $e;
// re-throw, if requested
}
return $this;
}