Skip to content

Instantly share code, notes, and snippets.

@johnnncodes
Forked from julien-c/global.php
Created December 29, 2013 16:57
Show Gist options
  • Save johnnncodes/8172278 to your computer and use it in GitHub Desktop.
Save johnnncodes/8172278 to your computer and use it in GitHub Desktop.
<?php
if (Config::has('sentry.key')) {
$bufferHandler = new Monolog\Handler\BufferHandler(
new Monolog\Handler\RavenHandler(
new Raven_Client(Config::get('sentry.key')),
Monolog\Logger::WARNING
)
);
App::instance('log.buffer', $bufferHandler);
Log::getMonolog()->pushHandler($bufferHandler);
}
App::shutdown(function() {
// Flush buffered logs
if (App::bound('log.buffer')) {
App::make('log.buffer')->close();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment