mead-steve/mono-snag

Bugsnag integration for monolog. An abstract handler that sends messages to Bugsnag

v3.0.0 2016-10-09 14:31 UTC

README

Build Status Coverage Status Latest Stable Version License Monthly Downloads

Monolog Handler connection to Bugsnag

Installation

Via Composer using

composer require mead-steve/mono-snag:^3.0.0

you should already have bugsnag and monolog required so your composer.json should look like:

  "require": {
        ...,
        "monolog/monolog": "____",
        "bugsnag/bugsnag": "____",
        ...,
        "mead-steve/mono-snag": "^3.0.0"
    }

Usage

A handler is provided that wraps up a Bugsnag client. By default the handler will grab anything at Logger::ERROR and above and send it to Bugsnag.


$logger  = new Monolog\Logger("Example");

$bugsnagClient = new Bugsnag\Client('YOUR-BUGSNAG-API-KEY-HERE');
//... bugsnag specific config goes here.
$bugsnagHandler = new \MeadSteve\MonoSnag\BugsnagHandler($bugsnagClient);

$logger->pushHandler($bugsnagHandler);

// The following error will get sent automatically to Bugsnag
$logger->addError("oh no!", array('exception' => new \Exception("ohnoception")));