PHP code example of smart-contact / smart-log-client

1. Go to this page and download the library: Download smart-contact/smart-log-client 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/ */

    

smart-contact / smart-log-client example snippets


SmartLogClient::report([
    'level' => 'info', //de' => '',
    'user' => 'John Doe', // 'registered_at' => 'Y-m-d H:i:s', //default now()
    'log' => [
        'key' => 'value',
    ],
    'extra' => [
        'key' => 'value',
    ],
    'formatted' => '',
    'user_agent' => 'USER AGENT', //default Jenssegers\Agent::getUserAgent, 
    'browser' => 'BROWSER', //default Jenssegers\Agent::browser
    'browser_version' => 'BROWSER VERSION', //default Jenssegers\Agent::version
    'platform' => 'PLATFORM', //default Jenssegers\Agent::plaform
    'platform_version' => 'PLATFORM VERSION', //default null
]);

SmartLogClient::info([
    'status_code' => '',
    'user' => 'John Doe', /// 'key' => 'value',
    ],
    'extra' => [
        'key' => 'value',
    ],
    'formatted' => '',
    'user_agent' => 'USER AGENT', //default Jenssegers\Agent::getUserAgent, 
    'browser' => 'BROWSER', //default Jenssegers\Agent::browser
    'browser_version' => 'BROWSER VERSION', //default Jenssegers\Agent::version
    'platform' => 'PLATFORM', //default Jenssegers\Agent::plaform
    'platform_version' => 'PLATFORM VERSION', //default null
]);

SmartLogClient::emergency($data);
SmartLogClient::critical($data);
SmartLogClient::error($data);
SmartLogClient::warning($data);
SmartLogClient::notice($data);
SmartLogClient::info($data);
SmartLogClient::debug($data);

'stack' => [
    'driver' => 'stack',
    'channels' => ['smartlog','single'],
    'ignore_exceptions' => false,
],

//Custom Channel
'smartlog' => [
    'driver' => 'custom',
    'handler' => \SmartContact\SmartLogClient\Logging\SmartLogHandler::class,
    'via' => \SmartContact\SmartLogClient\Logging\SmartLogLogger::class
],

namespace App\Exceptions;

class Handler extends \SmartContact\SmartLogClient\Exceptions\Handler
{

}

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use SmartContact\SmartLogClient\Traits\TrackingApplicationLogs;

class Order extends Model
{
    use HasFactory, TrackingApplicationLogs;
    
    //Default
    public static $recordEvents = [
        'retrieved', 
        'created', 
        'updated',
        'deleted',
        'restored' // if the model 
 shell script
php artisan vendor:publish --provider="SmartLogClient\SmartLogClientServiceProvider"