Yii2: Make Logger PSR-3 compatible

Created on 28 Dec 2013  路  3Comments  路  Source: yiisoft/yii2

Make Logger PSR-3 compatible so it will be easy to change logging library to another one.

Typical use case: if I want to start logging to Chrome Console, I don't have to write my own implementation of this based on Yii logger, but simply switch logging system to Monolog.

PSR-3: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md
Monolog: https://github.com/Seldaek/monolog

All 3 comments

Simliar to #1660

From what I understood, @qiangxue doesn't want to make it compatible because of 2 reasons:

  1. No categories from the box
  2. Too many log levels

From my point of view:

  1. Category could be placed in context array during delivering the message from Yii to logger component
  2. As it's a standard now, it's not so far that people will get used to it, as all other logger libraries will support all these levels. And Yii still has it's own shortcuts like Yii::trace(), Yii::error(), Yii::warning(), Yii::info(). There's no need to add such shortcuts for all the levels.

Yii is now part of PHP-FIG project. So why it doesn't care about it's standards?

We do care about standards that make sense for the framework such as phpdoc, new autoloader standard etc. All the interface standards are a bit too much: not giving much benefit but reducing code usability when used with a single framework.

Was this page helpful?
0 / 5 - 0 ratings