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

Commit 2292b97

Browse files
authored
Merge pull request #16 from bomas13/add_laravel_5.6+_support
Add basic Laravel 5.6+ support
2 parents f8583e8 + ccf971a commit 2292b97

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/Graylog2ServiceProvider.php

+11-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace Swis\Graylog2;
44

5-
use Illuminate\Support\Facades\Log;
65
use Illuminate\Support\ServiceProvider;
76

87
class Graylog2ServiceProvider extends ServiceProvider
@@ -18,7 +17,7 @@ public function boot()
1817
]);
1918

2019
// Register handler
21-
$monoLog = Log::getMonolog();
20+
$monoLog = $this->getMonolog();
2221
$monoLog->pushHandler(new Graylog2Handler(config('graylog2.log_level', 'debug')));
2322
}
2423

@@ -29,4 +28,14 @@ public function register()
2928
{
3029
$this->app->singleton('graylog2', Graylog2::class);
3130
}
31+
32+
/**
33+
* @return \Monolog\Logger
34+
*/
35+
private function getMonolog()
36+
{
37+
return $this->app['log'] instanceof \Illuminate\Log\LogManager
38+
? $this->app['log']->driver()
39+
: $this->app['log']->getMonolog();
40+
}
3241
}

0 commit comments

Comments
 (0)