wintercms / wintercms/winter

Add support for pushing custom events to the Event Log with sexy mode

Open
#1,364 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
1.5k
Forks
246
Avg merge
19h 2m
Merged PRs (30d)
7

Description

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:
Image

This is not really ideal, maybe we can think of something better like:

Log::prettyError($message, [
    // details...
]);

But nicer :)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names Winter's error handler, EventLog::getDetails(), and Log; start by tracing how caught exceptions become pretty Event Log pages. Define a supported way for callers to supply custom exception details, then verify those events render with the same page treatment without requiring manual payload construction.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend, observability-sre
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.