8000 [MonologBridge] Deprecate `Logger` class in favor of `Symfony\Bridge\Monolog\Monolog` by lyrixx · Pull Request #51229 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[MonologBridge] Deprecate Logger class in favor of Symfony\Bridge\Monolog\Monolog #51229

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions UPGRADE-6.4.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ MonologBridge
-------------

* Add native return type to `Logger::clear()` and to `DebugProcessor::clear()`
* Deprecate `Logger` class in favor of `Symfony\Bridge\Monolog\Monolog`

PsrHttpMessageBridge
--------------------
Expand Down
1 change: 1 addition & 0 deletions src/Symfony/Bridge/Monolog/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ CHANGELOG
---

* Add native return type to `Logger::clear()` and to `DebugProcessor::clear()`
* Deprecate `Logger` class in favor of `Symfony\Bridge\Monolog\Monolog`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to me, this new class should not be introduced either.

the removal of the debug loggers should either be implemented using a service configurator or we should make our debug processor itself able to behave like a no-op for environments where we don't want to collect those debug logs.

And the DebugLoggerInterface should be solved by injecting the DebugHandler in the collector instead of the main logger instance (which would be perfectly supported but is not wired this way in MonologBundle).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's first discuss about removing the @final in Seldaek/monolog#1827

Anyone up to do the PR implementing what @stof describes?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for being blunt but this looks like a mess to me. You'd get a Monolog class which you cannot even pass to something expecting a Logger instance (which you would right now do if you want to call reset() or smth on it.

Why not inject a DebugHandler in the Logger at runtime when in development for example?

Or worst case if you must extend Logger then go ahead and extend it, I just marked it final because people were extending it and doing crazy shit which then broke with new features. If you know what you are doing it is IMO safe to extend, and it's why it is just a @final and not a proper final keyword. I don't want to prevent people, but I want to make it clear that it voids the warranty if you do extend.

Maybe it'd be worth layout out what exactly you are trying to solve here, because I am not 100% sure I am up to speed. I'm happy to try and help find a solution, but removing @final is a no go for me right now.


6.1
---
Expand Down
4 changes: 4 additions & 0 deletions src/Symfony/Bridge/Monolog/Logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@
use Symfony\Component\HttpKernel\Log\DebugLoggerInterface;
use Symfony\Contracts\Service\ResetInterface;

trigger_deprecation('symfony/monolog-bridge', '6.4', 'The "%s" class is deprecated, use "%s" instead.', Logger::class, Monolog::class);

/**
* @author Fabien Potencier <fabien@symfony.com>
*
* @deprecated since Symfony 6.4, use Symfony\Bridge\Monolog\Monolog instead
*/
class Logger extends BaseLogger implements DebugLoggerInterface, ResetInterface
{
Expand Down
Loading
0