1. Go to this page and download the library: Download tartan/laravel-xlog library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
// passing string as the second parameter
$string = 'test'
XLog::info('log message', [$string]);
// passing array
$array = ['a' => 1, 'b' => 2, 'c' => 'value3', 'd' => 4.2];
XLog::info('log message', $array);
// log input data in the controller's action
XLog::info('verify transaction request', $request->all());
// The first parameter is the thrown exception. The second parameter specifies whether to log the trace or not. the third parameter is the level of the log. default value is `error`.
XLog::exception($exception, true);
XLog::exception($exception, true, 'error');
XLog::exception($e, false, 'emergency');