guidofaecke / monolog-stdout-handler
A handler for Monolog that sends messages to stdout (with color).
2.1.0
2021-07-28 05:13 UTC
Requires
- php: ^7.4 || ~8.0.0
- monolog/monolog: ^2.3.0
Requires (Dev)
- phpunit/phpunit: ^9.5.0
This package is auto-updated.
Last update: 2024-10-28 12:36:38 UTC
README
Provides a handler for Monolog that sends colored messages to stdout. Messages may be uncolored with a provided formatter.
Loggers are able to interprete a balise language (like bbcode) Balises currently recognized are :
[c=<color>]...[/c]
with color:black
,blue
,green
,cyan
,red
,purple
,yellow
,white
Example
How to use the stdout handler:
<?php use Monolog\Logger; use Monolog\Handler\StdoutHandler; $stdoutHandler = new StdoutHandler(); $logger = new Logger('cronjob'); $logger->pushHandler($stdoutHandler); $logger->error('[c=green]Hello world![/c]');
How to remove the colored formatter:
<?php use Monolog\Formatter\NoColorLineFormatter; $stdoutHandler->setFormatter(new NoColorLineFormatter(StdoutHandler::FORMAT));