Git Product home page Git Product logo

Comments (7)

josefsabl avatar josefsabl commented on June 12, 2024 3

I have this problem as well, using Contributte/Logging. Obviously this code Tracy\Debugger::getLogger()->mailer = ?; should not rely on the property to maybe exist, rather there should be something like MailLogger interface having the setMailer function.

Adding @ to suppress the deprecation provides a quick fix.

from tracy.

mabar avatar mabar commented on June 12, 2024 1

In this case best solution would probably be to throw an exception in case logger is not instance of Tracy\Logger. You are using different ILogger implementation that does not support sending emails.

from tracy.

mabar avatar mabar commented on June 12, 2024 1

@radimvaculik I fixed the issue in orisai/nette-monolog. You should be fine if you copy LazyTracyToPsrLogger changes to your SentryDecoratedTracyLogger orisai/nette-monolog@6f39f96#diff-34f516dc85e79726f910d1b0e989ea939cbf310611cf0507e69eee3b4a12a127R56-R110

from tracy.

mabar avatar mabar commented on June 12, 2024

Do you override the logger yourself? Or is it overriden by some logging extension?
I think I already solved that issue in both orisai/nette-monolog and contributte/monolog by preserving original logger (in case Tracy bridge is enabled)

from tracy.

radimvaculik avatar radimvaculik commented on June 12, 2024

@mabar I use final class SentryDecoratedTracyLogger implements ILogger and use $this->parentLogger = Debugger::getLogger(); to preserve Tracy logging.

from tracy.

mabar avatar mabar commented on June 12, 2024

Oh, my solution is currently broken too.

It overrides logger returned by Debugger::getLogger() and disables autowiring for service tracy.logger so my ILogger implementation is autowired instead even if service tracy.logger is created before Monolog has chance to wire into Tracy.

But. Order matters. If Monolog extension is loaded first, Tracy sets options to incorrect logger.
My case would be fixed by replacing Tracy\Debugger::getLogger()->mailer = by $this->getService('tracy.logger')->mailer = in generated DIC

from tracy.

slepic avatar slepic commented on June 12, 2024

I have the very same problem in a custom implementation of Tracy\ILogger.

My current solution is to place a public $mailer property on my implementation and ignore it's value.

And I 100% agree that Tracy\ILogger does not support email and should not be treated as Tracy\Logger (or anything) which supports email. If a mailer is to be set, you better make sure that you're dealing with Tracy\Logger before you start accessing properties that cannot possibly ever exist on the interface (in fact, on any interface).

Adding magic methods to my implementation is a no go,
Adding a setMailer() method to the interface (or an extended interface) seems viable even if it would be BC. I mean, unless the motto is "If it's broken and we cannot fix it without introducing a BC, we'd rather not fix it at all"....

from tracy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.