Created
December 1, 2016 10:32
-
-
Save uyab/e266cdfa9d76670d627046ed0ec8cf4e to your computer and use it in GitHub Desktop.
Memisah log aplikasi Laravel berdasar level dan process name (web atau cli)
This file contains hidden or 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
// bootstrap/app.php | |
$app->configureMonologUsing(function ($monolog) use ($app) { | |
$bubble = false; | |
foreach ($monolog->getLevels() as $name => $level) { | |
$name = strtolower($name); | |
$filename = $app->storagePath()."/logs/{$name}-".php_sapi_name().".log"; | |
$monolog->pushHandler(new \Monolog\Handler\RotatingFileHandler($filename, 0, $level, $bubble, 0666)); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment