Skip to content

Instantly share code, notes, and snippets.

@anothergituser
Created July 27, 2015 14:44
Show Gist options
  • Save anothergituser/13be0442113433a37ea1 to your computer and use it in GitHub Desktop.
Save anothergituser/13be0442113433a37ea1 to your computer and use it in GitHub Desktop.
Laravel 4.2 clean logs
App::error(function(Exception $exception, $code)
{
if ($exception instanceof Symfony\Component\HttpKernel\Exception\NotFoundHttpException) {
Log::error([
'route' => Request::fullUrl(),
'user_id' => Auth::check() ? Auth::id() : "Anonymous",
'code' => $code,
'ip' => Request::ip(),
'headers' => Request::header('user-agent')
]);
}
$e = (string) $exception;
$msg = preg_replace('/Stack trace:.*/is', '', $e);
Log::error($msg);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment