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

Commit

Permalink
apply changes from 'The-Hasanov'
Browse files Browse the repository at this point in the history
  • Loading branch information
bomas13 committed Jan 22, 2019
1 parent f8583e8 commit ccf971a
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 ccf971a

Please sign in to comment.