PHP code example of schauinsland / laravel-splunk-logger

1. Go to this page and download the library: Download schauinsland/laravel-splunk-logger 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/ */

    

schauinsland / laravel-splunk-logger example snippets


Log::channel('splunk')->info('Custom Log Info referring explicit splunk');

Log::error(
    'This is a custom Error',
    ['user_id' => 1, 'name' => 'John Doe', 'email' => '[email protected]', 'is_admin' => false]
);

try {
    DB::table('non_existent_table')->get();
} catch (\Exception $e) {
    Log::error('Error with Trace', [
        'message' => $e->getMessage(),
        'stack' => $e->getTraceAsString(),
    ]);
}