tracy icon indicating copy to clipboard operation
tracy copied to clipboard

Enrich tracy error mail with request method

Open KminekMatej opened this issue 3 years ago • 6 comments

  • new feature
  • BC break? no
  • doc PR: nette/docs# 2B after approval

When using nette/tracy for API project, having request method in tracy error mail is for us highly valuable information. I simply injected this information right after source url. If the method was GET, nothing gets injected (kinda like default method). Method gets injected only for all other methods

KminekMatej avatar Jun 01 '21 10:06 KminekMatej

I would prefer a more general solution, where you could redefine the content of the mail yourself.

dg avatar Jun 02 '21 15:06 dg

Well, me too :). That means you have it on the roadmap, so I shoudlnt participate?

KminekMatej avatar Jun 10 '21 07:06 KminekMatej

No, I don't. Try to come up with a solution that works for you.

dg avatar Jun 10 '21 10:06 dg

@KminekMatej I think in Tracy should exist interface EmailRenderer with default implementation for render e-mail message.

For example:

interface EmailRenderer
{
    public function render(\Throwable $e, ?string $message, string $level): string;
}

janbarasek avatar Jun 18 '21 08:06 janbarasek

Something like that, yea. I've been thinking about possibility to render email body using user-specified latte template. User would simply put path to latte file into config.neon (somewhere underneath the tracy section in config). If no latte template would be specified, some default one should be used - or maybe just current solution would be used (simply text, no latte rendering).

This template would have some important variables injecte, like httpRequest, httpResponse, etc.

But I really didnt start to design any implementation as Ive been pretty busy lately, just made some private brainstorming

KminekMatej avatar Jun 18 '21 08:06 KminekMatej

It's not such a requested feature, so a callback instead of an interface would probably be enough…

dg avatar Jun 18 '21 09:06 dg

Closing due to inactivity.

dg avatar Feb 27 '23 13:02 dg