new: [internal] New AppModel::logException method

pull/5217/head
Jakub Onderka 2019-09-24 20:52:36 +02:00 committed by GitHub
parent cebe7de575
commit acd90d9675
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 0 deletions

View File

@ -2362,4 +2362,21 @@ class AppModel extends Model
}
}
}
/**
* @param string $message
* @param Exception $exception
* @param int $type
* @return bool
*/
protected function logException($message, Exception $exception, $type = LOG_ERR)
{
$message = sprintf("%s\n[%s] %s",
$message,
get_class($exception),
$exception->getMessage()
);
$message .= "\nStack Trace:\n" . $exception->getTraceAsString();
return $this->log($message, $type);
}
}