Skip to content
This repository has been archived by the owner on Jan 11, 2022. It is now read-only.

Commit

Permalink
Merge pull request #16 from bomas13/add_laravel_5.6+_support
Browse files Browse the repository at this point in the history
Add basic Laravel 5.6+ support
  • Loading branch information
JaZo authored Jan 22, 2019
2 parents f8583e8 + ccf971a commit 2292b97
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/Graylog2ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Swis\Graylog2;

use Illuminate\Support\Facades\Log;
use Illuminate\Support\ServiceProvider;

class Graylog2ServiceProvider extends ServiceProvider
Expand All @@ -18,7 +17,7 @@ public function boot()
]);

// Register handler
$monoLog = Log::getMonolog();
$monoLog = $this->getMonolog();
$monoLog->pushHandler(new Graylog2Handler(config('graylog2.log_level', 'debug')));
}

Expand All @@ -29,4 +28,14 @@ public function register()
{
$this->app->singleton('graylog2', Graylog2::class);
}

/**
* @return \Monolog\Logger
*/
private function getMonolog()
{
return $this->app['log'] instanceof \Illuminate\Log\LogManager
? $this->app['log']->driver()
: $this->app['log']->getMonolog();
}
}

0 comments on commit 2292b97

Please sign in to comment.