winter
winter copied to clipboard
Add support for pushing custom events to the Event Log with sexy mode
Currently, new exceptions caught by the Winter error handler get pretty event log pages, it would be nice to support users doing so as well.
You can achieve this via:
Log::error($message, array_merge(
(new EventLog())->getDetails(new \Exception()),
[
'exception' => [
'type' => 'HttpError',
'message' => $message,
'code' => $response->code,
'file' => __FILE__,
'line' => __LINE__ - 8,
'snippet' => explode(PHP_EOL, $snippet),
'stringTrace' => $snippet,
'trace' => [],
'previous' => null
],
]
));
Which ends up looking like this:
This is not really ideal, maybe we can think of something better like:
Log::prettyError($message, [
// details...
]);
But nicer :)