stuzzo/monolog-extender

Monolog wrapper that extends formatters and processors to add further informations

2.1 2018-01-24 17:53 UTC

This package is auto-updated.

Last update: 2024-03-27 00:20:23 UTC


README

Total Downloads Latest Stable Version

Monolog sends your logs to files, sockets, inboxes, databases and various web services. See the complete reference

This library extends Monolog's handlers and processors adding data to the record generated from processors. Furthermore the library improves logs format.

Installation

Install the latest version with

$ composer require stuzzo/monolog-extender

Basic Usage

<?php
use Monolog\Logger;
use Monolog\Handler\StreamHandler;

// create a log channel
$log = new Logger('request');

$handler = new StreamHandler('path/to/your.log', Logger::WARNING);

$formatter = new \Stuzzo\Monolog\Formatter\StreamFormatter(null, 'Y-m-d H:i:s');
$handler->setFormatter($formatter);
$log->pushHandler($handler);

try {
    throw new \RuntimeException('Something happen');
} catch (\Exception $exception) {
    $log->critical('Error', ['exception' => $exception]);
}

Documentation

About

Requirements

  • This library works with PHP 5.5.9 or above.

Author

Alfredo Aiello - stuzzo@gmail.com - http://twitter.com/stuzzo