Download the PHP package ostrolucky/semantic-monolog-handler without Composer
On this page you can find all versions of the php package ostrolucky/semantic-monolog-handler. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ostrolucky/semantic-monolog-handler
More information about ostrolucky/semantic-monolog-handler
Files in ostrolucky/semantic-monolog-handler
Package semantic-monolog-handler
Short Description Opinionated Monolog FingersCrossed handler which bypasses fingers-crossed behaviour for some primary channels
License MIT
Informations about the package semantic-monolog-handler
Semantic Monolog Handler
This is a FingersCrossed handler that fills a missing gap in Monolog configuration:
It allows to have "primary" channels. If log is being written to one of these "primary" channels, it skips fingers crossed behaviour. This is combined with support for a Log Level. So you can still apply fingers crossed behaviour to message from primary channel, if it has low severity.
Best real world scenario of this is to be able to rely on >= INFO "app" logs always being written, no matter if there was an error or not (and if there was an error, ensure these log entries are not written twice).
This is something that's impossible to configure without writing custom handler, unless you are fine with duplicate log entries.
Install
Via Composer
Example configuration
Handler configured following way will write all the logs to standard error output if any of the logs reach "ERROR" level, which is a standard FingersCrossed behaviour.
However, on top of it, it will also immediately print logs from "app" channel, unless they are under "DEBUG" level - without triggering FingersCrossed handler (which would flush all the logs).
Example Symfony Monolog configuration
Above PHP configuration can be reflected in Symfony like so:
monolog.yaml:
Licensing
MIT license. Please see License File for more information.