yiisoft / yii2-psr-log-source
A PSR LoggerInterface implementation that routes to the Yii logger
Package info
github.com/yiisoft/yii2-psr-log-source
Type:yii2-extension
pkg:composer/yiisoft/yii2-psr-log-source
Requires
- php: >=8
- psr/log: ^3
- yiisoft/yii2: >=2.0.4
Requires (Dev)
- captainhook/plugin-composer: ^5.3
- phpstan/phpstan: ^1.8
- phpunit/phpunit: 9.5.10
- ramsey/conventional-commits: ^1.3
- symplify/easy-coding-standard: ^10.1
- vimeo/psalm: ^4.22
Provides
This package is auto-updated.
Last update: 2026-02-11 19:00:05 UTC
README
This simple library implements a PSR compatible logger that routes all messages to a Yii Logger. Use this if you have a library that needs such a logger and you want to forward the messages to your existing Logger.
Logger adapter
The Logger adapter class takes a Yii Logger object and implements the LoggerInterface.
DynamicLogger
Since Yii2 uses mutability a lot, the Logger adapter might hold a reference to an old Yii Logger. To work properly
with the Service Locator pattern we must use it on every call. DynamicLogger does this while internally using the Logger
and recreating it when needed.