Re: PSR-3 context exception key, change to allow `Throwable`

2021-07-06 Thread Sasezaki
 Hi, Larry.

Thanks you for checking. And I'm glad to hear considering.


2021年7月4日日曜日 23:54:40 UTC+9 Larry Garfield:

> On Sun, Jul 4, 2021, at 3:35 AM, Sasezaki wrote:
> > Hi.
> > 
> > I have suggestion for psr-3 context's key 'exception'.
> > Could be change allow `\Throwable` to accept ?
> > 
> > current psr-3
> > 
> https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md
> > > 'exception' key is actually an Exception.
> > 
> > I think this was designed for PHP 5 age. 
> > 
> > But, recent Monolog 's code is
> > > if (isset($context['exception']) && $context['exception'] instanceof 
> > Throwable) {
> > 
> https://github.com/Seldaek/monolog/blob/2.2.0/src/Monolog/Handler/RollbarHandler.php#L92
> > 
> > Other LoggerInterface implementer would be confused.
> > "should it be strictly `\Exception` ? or `\Throwable` ?".
> > 
> > --
> > 
> > And from strict analysis tool usage (array-shapes stubs), it also 
> > needs to be clear \Exception or \Throwable.
> > 
> > I have several implmentaion as example,
> > 
> > array{exception?: \Exception} $context
> > 
> https://github.com/struggle-for-php/sfp-psalm-psr-log-plugin/blob/0.2.0/stubs/LoggerInterface.php
> > 
> > array{exception?: \Throwable} $context
> > 
> https://github.com/struggle-for-php/sfp-psalm-psr-log-plugin/blob/0.2.0/throwable-stubs/LoggerInterface.php
>
> You are correct, PSR-3 was developed around the PHP 5.4 era. I would be 
> fine with adding an Errata to the metadoc that says "Throwables generally". 
> That would require a PR and a Core Committee vote.
>
> Note that PSR-3 doesn't have a metadoc yet. :-) It's that old. There's 
> another vote in progress to add types to the interface packages that 
> includes adding a metadoc file. I'd say wait until that finishes (it looks 
> like it's going to easily pass), and then it will be possible to add 
> another errata to it in a second step.
>
> --Larry Garfield
>

-- 
You received this message because you are subscribed to the Google Groups "PHP 
Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to php-fig+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/php-fig/f2a9e90a-3fb5-4171-8166-874086c05916n%40googlegroups.com.


Re: PSR-3 context exception key, change to allow `Throwable`

2021-07-04 Thread Larry Garfield
On Sun, Jul 4, 2021, at 3:35 AM, Sasezaki wrote:
> Hi.
> 
> I have suggestion for psr-3 context's key 'exception'.
> Could be change allow `\Throwable` to accept ?
> 
> current psr-3
> https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md
> > 'exception' key is actually an Exception.
> 
> I think this was designed for PHP 5 age. 
> 
> But, recent Monolog 's code is
> > if (isset($context['exception']) && $context['exception'] instanceof 
> Throwable) {
> https://github.com/Seldaek/monolog/blob/2.2.0/src/Monolog/Handler/RollbarHandler.php#L92
> 
> Other LoggerInterface implementer would be confused.
> "should it be strictly `\Exception` ? or `\Throwable`  ?".
> 
> --
> 
> And  from strict analysis tool usage (array-shapes stubs), it also 
> needs to be clear  \Exception or  \Throwable.
> 
> I have several implmentaion as example,
> 
> array{exception?: \Exception}  $context
> https://github.com/struggle-for-php/sfp-psalm-psr-log-plugin/blob/0.2.0/stubs/LoggerInterface.php
> 
> array{exception?: \Throwable}  $context
> https://github.com/struggle-for-php/sfp-psalm-psr-log-plugin/blob/0.2.0/throwable-stubs/LoggerInterface.php

You are correct, PSR-3 was developed around the PHP 5.4 era.  I would be fine 
with adding an Errata to the metadoc that says "Throwables generally".  That 
would require a PR and a Core Committee vote.

Note that PSR-3 doesn't have a metadoc yet. :-)  It's that old.  There's 
another vote in progress to add types to the interface packages that includes 
adding a metadoc file.  I'd say wait until that finishes (it looks like it's 
going to easily pass), and then it will be possible to add another errata to it 
in a second step.

--Larry Garfield

-- 
You received this message because you are subscribed to the Google Groups "PHP 
Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to php-fig+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/php-fig/b8705a16-67f5-49b7-99a5-e323fa102e08%40www.fastmail.com.


PSR-3 context exception key, change to allow `Throwable`

2021-07-04 Thread Sasezaki
 Hi.

I have suggestion for psr-3 context's key 'exception'.
Could be change allow `\Throwable` to accept ?

current psr-3
https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md
> 'exception' key is actually an Exception.

I think this was designed for PHP 5 age. 

But, recent Monolog 's code is
> if (isset($context['exception']) && $context['exception'] instanceof 
Throwable) {
https://github.com/Seldaek/monolog/blob/2.2.0/src/Monolog/Handler/RollbarHandler.php#L92

Other LoggerInterface implementer would be confused.
"should it be strictly `\Exception` ? or `\Throwable`  ?".

--

And  from strict analysis tool usage (array-shapes stubs), it also needs to 
be clear  \Exception or  \Throwable.

I have several implmentaion as example,

array{exception?: \Exception}  $context
https://github.com/struggle-for-php/sfp-psalm-psr-log-plugin/blob/0.2.0/stubs/LoggerInterface.php

array{exception?: \Throwable}  $context
https://github.com/struggle-for-php/sfp-psalm-psr-log-plugin/blob/0.2.0/throwable-stubs/LoggerInterface.php


-- 
You received this message because you are subscribed to the Google Groups "PHP 
Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to php-fig+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/php-fig/adffa7a4-c59c-4106-8ee5-9cf0db479e02n%40googlegroups.com.