Skip to content

Conversation

@JanTvrdik
Copy link
Contributor

@JanTvrdik JanTvrdik commented Aug 27, 2018

@dg Would you accept PR with PSR-3 adapter? So it would be possible to use any PSR-3 compatible logger (e.g. Monolog) with Tracy, i.e. the following would be possible

$psrLogger = new Monolog\Logger(...);
$tracyLogger = new Tracy\Bridges\Psr\PsrLoggerAdapter($psrLogger);
Tracy\Debugger::setLogger($tracyLogger);

Or we could even apply the adapter automatically, so the following would be possible:

$psrLogger = new Monolog\Logger(...);
Tracy\Debugger::setLogger($psrLogger);

@JanTvrdik
Copy link
Contributor Author

@dg Related question – would you accept PR with TracyLoggerToPsrLoggerAdapter (i.e. the other way around)? The following would be possible

$tracyLogger = Tracy\Debugger::getLogger();
$psrLogger = new Tracy\Bridges\Psr\TracyLoggerToPsrLoggerAdapter($tracyLogger);

$monolog = new Monolog\Logger(...);
$monolog->pushHandler(new Monolog\Handler\SyslogHandler(...));
$monolog->pushHandler(new Monolog\Handler\PsrHandler($psrLogger));

// ...

$tracyLogger = new Tracy\Bridges\Psr\PsrLoggerToTracyLoggerAdapter($monolog);
Tracy\Debugger::setLogger($tracyLogger);

@JanTvrdik
Copy link
Contributor Author

Alternative is to put those adapters to https://github.com/contributte/psr3-logging cc @f3l1x

@f3l1x
Copy link
Member

f3l1x commented Aug 27, 2018

We can put these adapters into https://github.com/contributte/psr3-logging, if it'll be not part of the Tracy.

@dg
Copy link
Member

dg commented Aug 27, 2018

Would you accept PR with PSR-3 adapter? So it would be possible to use any PSR-3 compatible logger (e.g. Monolog) with Tracy, i.e. the following would be possible

If it is really useful, surely. (I suppose otherwise you wouldn't want it.)

Or we could even apply the adapter automatically, so the following would be possible:

It looks nice, but it means that the code in src knows about the code in bridges.

would you accept PR with TracyLoggerToPsrLoggerAdapter (i.e. the other way around)? The following would be possible

Names TracyToPsrLoggerAdapter & PsrToTracyLoggerAdapter seems imho better.


Is it somehow related to #281 & #283 ?

@JanTvrdik
Copy link
Contributor Author

JanTvrdik commented Aug 27, 2018

The issue has been converted to PR with implementation. The tests failed on Travis with and odd error

Return value of Tester\Runner\Job::getHeaders() must be of the type array, null returned

which looks like either Tester (cc @milo) or PHP bug.


Is it somehow related to #281 & #283 ?

Not directly, but indirectly, yes.

  • PsrToTracyLoggerAdapter makes it easy to use any third party PSR-3 logger with Tracy, therefore reducing the need for having StreamLogger in Tracy.
  • TracyToPsrLoggerAdapter makes it easy to use any Tracy\ILogger with any library that can log to PSR-3 logger. This makes splitting Tracy\Logger to multiple smaller Tracy\ILogger implementations even more valuable as it allows for example using Tracy\BlueScreenLogger as one of Monolog handlers.

@JanTvrdik JanTvrdik closed this Aug 27, 2018
@JanTvrdik JanTvrdik reopened this Aug 27, 2018
@JanTvrdik
Copy link
Contributor Author

I restarted the build on Travis by using close-reopen combo and the test now works.

@f3l1x
Copy link
Member

f3l1x commented Aug 27, 2018

Cool. 🤗

@dg
Copy link
Member

dg commented Aug 27, 2018

Thanks, merged.

@dg dg merged commit 6b9675e into nette:master Aug 27, 2018
@JanTvrdik JanTvrdik deleted the pr/psr branch August 27, 2018 18:45
dg pushed a commit that referenced this pull request Sep 24, 2018
dg pushed a commit that referenced this pull request Sep 24, 2018
dg pushed a commit that referenced this pull request Sep 30, 2018
dg pushed a commit that referenced this pull request Oct 5, 2018
dg pushed a commit that referenced this pull request Oct 24, 2018
dg pushed a commit that referenced this pull request Nov 2, 2018
dg pushed a commit that referenced this pull request Nov 5, 2018
dg pushed a commit that referenced this pull request Nov 5, 2018
dg pushed a commit that referenced this pull request Nov 5, 2018
@slischka
Copy link

When will be this released ?

@mabar
Copy link
Contributor

mabar commented Nov 16, 2018

Nette 3.0

dg pushed a commit that referenced this pull request Nov 23, 2018
dg pushed a commit that referenced this pull request Feb 5, 2019
dg pushed a commit that referenced this pull request Feb 5, 2019
dg pushed a commit that referenced this pull request Feb 5, 2019
dg pushed a commit that referenced this pull request Feb 5, 2019
dg pushed a commit that referenced this pull request Feb 10, 2019
dg pushed a commit that referenced this pull request Feb 11, 2019
dg pushed a commit that referenced this pull request Feb 11, 2019
dg pushed a commit that referenced this pull request Feb 12, 2019
dg pushed a commit that referenced this pull request Feb 14, 2019
dg pushed a commit that referenced this pull request Feb 15, 2019
dg pushed a commit that referenced this pull request Feb 15, 2019
dg pushed a commit that referenced this pull request Feb 15, 2019
dg pushed a commit that referenced this pull request Feb 17, 2019
dg pushed a commit that referenced this pull request Feb 17, 2019
dg pushed a commit that referenced this pull request Feb 17, 2019
dg pushed a commit that referenced this pull request Feb 17, 2019
dg pushed a commit that referenced this pull request Feb 17, 2019
dg pushed a commit that referenced this pull request Feb 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants