PHP code example of ka4ivan / laravel-logger

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

    

ka4ivan / laravel-logger example snippets

  
Route::get('logs', [\Ka4ivan\LaravelLogger\Http\Controllers\LogViewerController::class, 'index'])->name('logs');  

  

return [  
    'default' => env('LOG_CHANNEL', 'stack'),  

    'tracking' => [  
        'default' => 'tracking',  
    ],  

    'user' => [  
        'fields' => ['id', 'email', 'name'],  
    ],  

    'channels' => [  
        'tracking' => [  
            'driver' => 'daily',  
            'path' => storage_path('logs/_tracking.log'),  
            'level' => env('LOG_LEVEL', 'debug'),  
            'days' => 30,  
            'active' => env('LOGGING_ROUTES_ACTIVE', true),  
        ],  
    ],  

    'max_file_size' => 52428800, // 50MB  

    'pattern' => env('LOGGER_PATTERN', '*.log'),  

    'storage_path' => env('LOGGER_STORAGE_PATH', storage_path('logs')),  
];  
  
use Ka4ivan\LaravelLogger\Facades\Llog;  

// Example  
Llog::warning('Something happened', [  
    'users' => User::count(),  
    'products' => Product::count(),  
    'variations' => Product::count(),  
    'orders' => Order::count(),  
    'leads' => Lead::count(),  
]);  

use Ka4ivan\LaravelLogger\Facades\Llog;  

// Example  
Llog::info([  
    'first' => Brand::find('545e94e7-720f-4df6-9bef-bc0684f30690'),  
    'second' => Brand::find('16df9b24-52f3-4d39-9d96-ae24b6ad3a6a'),  
]);  
  
use Ka4ivan\LaravelLogger\Models\Traits\HasTracking;  

class Article extends Model  
{  
    use HasTracking;  
}
  
$data = Article::first();  

$res = json_pretty($data);  
shell  
php artisan vendor:publish --provider="Ka4ivan\LaravelLogger\ServiceProvider"