PHP code example of darkton / laravel-loki

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

    

darkton / laravel-loki example snippets


'channels' => [
    // ...

    'loki' => [
        'driver' => 'monolog',
        'handler' => \Darkton\Loki\Logging\LokiRedisHandler::class,
    ],
],

use Illuminate\Support\Facades\Log;

Log::channel('loki')->info('This log will be saved in Redis and later dispatched to Loki!');

use Illuminate\Support\Facades\Schedule;

Schedule::command('loki:sync')->everyMinute();
bash
php artisan vendor:publish --tag="loki-config"
bash
php artisan loki:sync