Skip to content

Instantly share code, notes, and snippets.

@peterfox
Created March 12, 2014 20:30
Show Gist options
  • Save peterfox/9515686 to your computer and use it in GitHub Desktop.
Save peterfox/9515686 to your computer and use it in GitHub Desktop.
This is a simple piece of code that can be added to Laravel's global.php file to start logging to Logentries.
/*
|--------------------------------------------------------------------------
| LogEntries Error Logger
|--------------------------------------------------------------------------
|
| This adds a handler to Monolog which will send logging data to the cloud service
| log entries. Make sure there is a logentries.php in your config folder with
| an array key defined as 'token'. The format of the messages will be the same
| minus the time and date as the service itself will record that.
|
*/
$handler = new \Logentries\Handler\LogentriesHandler(Config::get('logentries.token'));
$handler->setFormatter(new Monolog\Formatter\LineFormatter("%channel%.%level_name%: %message% %context% %extra%\n"));
Log::getMonolog()->pushHandler($handler);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment