samdark / yii2-psr-log-target

Yii 2.0 log target that is able to write messages to PSR-3 compatible logger
BSD 3-Clause "New" or "Revised" License
80 stars 15 forks source link

Allow to pass closure as logger configuration option #34

Open kminek opened 1 year ago

kminek commented 1 year ago

currently you need to pass monolog logger instance inside config file. this is unfortunate as logger is created for each request even in situations where nothing is logged. also you cannot use Yii aliases to configure monolog handlers.

samdark commented 1 year ago

Good idea. Do you have time to implement it?

kminek commented 1 year ago

Sure here it is: https://github.com/samdark/yii2-psr-log-target/pull/35

bencroker commented 1 year ago

This change breaks classes that extend PsrTarget and override the setLogger method, please revert! https://github.com/craftcms/cms/blob/88a80e76493b3b4ef53512bb34742c116dda191c/src/log/MonologTarget.php#L114-L117

Screenshot 2023-04-15 at 17 02 37
samdark commented 1 year ago

Owww. Sorry. Removed both tag and commit.

samdark commented 1 year ago

@kminek we can still solve it but with keeping the interface.

kminek commented 1 year ago

@samdark second attempt: https://github.com/samdark/yii2-psr-log-target/pull/36

bencroker commented 1 year ago

Owww. Sorry. Removed both tag and commit.

Thanks!