Skip to content

Commit

Permalink
Merge pull request #2835 from CachetHQ/syslog-logs
Browse files Browse the repository at this point in the history
Smarter monolog integration
  • Loading branch information
jbrooksuk committed Dec 3, 2017
2 parents 972ed9e + 2b2968b commit 5b460d2
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions app/Http/Controllers/Dashboard/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\View;
use Illuminate\Support\Str;
use Monolog\Handler\SyslogHandler;

class SettingsController extends Controller
{
Expand Down Expand Up @@ -270,11 +271,15 @@ public function showLogView()

$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);
}
Expand Down

0 comments on commit 5b460d2

Please sign in to comment.