Can we create a custom log file for different purposes in laravel 5.2 like for order related log entries that should be in order.log and for payment related stuff the entry shou
I managed my own log function which can be put in helper.php file in app dir.
if ( ! function_exists( 'write_log' ) ) {
/**
* Write log to log file
*
* @param string|array|object $log
*/
function write_log( $log ) {
if ( env('APP_LOG_LEVEL', 'debug') == 'debug' ) {
if ( is_array( $log ) || is_object( $log ) ) {
file_put_contents(laravelInstallDir().'../debug.log', print_r( $log, true ), FILE_APPEND);
} else {
file_put_contents(laravelInstallDir().'../debug.log', $log, FILE_APPEND);
}
}
}
}
Please adjust the path laravelInstallDir().'../debug.log' as need