Smarter monolog integration. Fixes #2823

This commit is contained in:
James Brooks 2017-12-03 17:01:55 +00:00
parent e95fc790fe
commit 2b2968bca5

View File

@ -27,6 +27,7 @@ use Illuminate\Support\Facades\Redirect;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\View;
use Illuminate\Support\Str;
use Monolog\Handler\SyslogHandler;
class SettingsController extends Controller
{
@ -270,11 +271,15 @@ class SettingsController extends Controller
$log = app(Writer::class)->getMonolog();
if (file_exists($path = $log->getHandlers()[0]->getUrl())) {
$logContents = file_get_contents($path);
} else {
$logContents = '';
}
$logContents = '';
collect($log->getHandlers())->reject(function ($handler) {
return $handler instanceof SyslogHandler;
})->each(function ($handler) use ($logContents) {
if (file_exists($path = $log->getHandlers()[0]->getUrl())) {
$logContents = file_get_contents($path);
}
});
return View::make('dashboard.settings.log')->withLog($logContents)->withSubMenu($this->subMenu);
}