Created
July 27, 2015 14:44
-
-
Save anothergituser/13be0442113433a37ea1 to your computer and use it in GitHub Desktop.
Laravel 4.2 clean logs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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