kmelia/monolog-stdout-handler

This package is abandoned and no longer maintained. The author suggests using the maxime-pasquier/monolog-stdout-handler package instead.

A handler for Monolog that sends messages to stdout (with color).

1.2.1 2015-10-23 16:14 UTC

This package is auto-updated.

Last update: 2020-02-27 12:45:58 UTC


README

Latest Stable Version Build Status

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));