Closed antonmarin closed 7 years ago
I'm OK with replacing some implementations with better components. I haven't really compared Monolog to our implementation in detail. What are cons and pros?
Pros:
Cons:
Changing interface is possible in 2.1 so PSR-3 could be excluded from the list of cons, I think.
How about performance? Logging is very central application thing so if Monolog is significantly slower, it would be seen immediately.
Well, monolog logger is just an observer that throws messages to handlers. So it is closer to yii target then yii logger. I think it is suitable to use same dispatcher with some additions doing this we can achieve same performance and increase count of handlers. Smth like:
Sounds interesting to try to me. @yiisoft/core-developers thoughts?
Support of Monolog
is a matter of PSR-3 support. There was an issue about this already - #1676.
Also there is related issue #7555. It actually may happen some extension for Monolog support already exists.
As i said earlier, there is extension yii2-monolog. We are talking about core usage and profit of many handlers already implemented
We are talking about core usage and profit of many handlers already implemented
Following this path, inside the core there should be support for PSR-3 compatible logger. Then monolog
can be used as a particular one.
Including monolog
as a a default log processor will create an external dependency, which contradicts #8452.
I think that would do. Overall Yii logging is implemented well so there's no intent dropping it in favor of anything to save maintenance cost.
I'll leave it open since I want to try creating PSR-3 target for our logger.
Here's an extension: https://github.com/samdark/yii2-psr-log-target
For 2.1 we may consider either making out logger PSR-3 compatible or replacing it with Monolog.
It is available to make Logger psr-compatible without breaking BC if Yii uses only shortcuts. What you think about it? I can prepare PR
@antonmarin I don't think you can make Yii logger PSR-compatible in 2.0.x because PSR-3 requires absence of non-standard log levels.
Users SHOULD NOT use a custom level without knowing for sure the current implementation supports it.
Sounds like recommendation and we can split logger to Logger and Profiler. @samdark what is your opinion about this way?
Right. It's a recommendation. Worth trying then...
PR opened: #14611
Resolved via #14611
Monolog used by many frameworks. Have you thought about using monolog instead own logger implementation?
P.S. I know about yii2-monolog extension. I mean core usage