bloatless/mono-pile

Monolog Handler and Formatter for Pile.

v0.3.0 2023-04-20 06:08 UTC

This package is not auto-updated.

Last update: 2024-11-19 12:19:04 UTC


README

A Monolog handler (and formatter) for Pile.

Installation

You can install this library using composer:

php composer.phar require bloatless/mono-pile

Usage

<?php

// init Monolog
$logger = new \Monolog\Logger('MyLogger');

// init Pile handler and formatter
$handler = new \Bloatless\MonoPile\PileHandler('https://my.pileinstance.com/api/v1/log', 'myapikey');
$formatter = new \Bloatless\MonoPile\PileFormatter('SomeProjectId');
$handler->setFormatter($formatter);

// Push handler into Monolog
$logger->pushHandler($handler);

// Log your errors
$logger->debug('Some debug message...');

Of course you can also use the Pile handler in frameworks using Monolog as their internal error logging solution - like Laravel oder Lumen.

License

MIT