PHP code example of kssadi / log-tracker

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

    

kssadi / log-tracker example snippets


return [
    // Base URL: https://your-domain.com/log-tracker
    'route_prefix' => 'log-tracker',

    // Middleware applied to all routes
    'middleware' => ['web', 'auth'],

    // UI theme: 'GlowStack' (dark, modern) | 'LiteFlow' (light, minimal)
    'theme' => 'GlowStack',

    // Entries shown per page in the log viewer
    'log_per_page' => 50,

    // Log files shown per page on the file listing
    'log_files_per_page' => 10,

    // Dashboard stats cache TTL in seconds (0 = disabled)
    'dashboard_cache_ttl' => 60,

    // Maximum log file size (MB) that can be processed
    'max_file_size' => 50,

    // Allow log file deletion via the UI
    'allow_delete' => false,

    // Allow log file download
    'allow_download' => true,

    // Log level display configuration (color + icon)
    'log_levels' => [
        'emergency' => ['color' => '#b91c1c', 'icon' => 'fas fa-exclamation-circle'],
        'critical'  => ['color' => '#b91c1c', 'icon' => 'fas fa-exclamation-triangle'],
        'alert'     => ['color' => '#b91c1c', 'icon' => 'fas fa-exclamation-circle'],
        'error'     => ['color' => '#dc2626', 'icon' => 'fas fa-times-circle'],
        'warning'   => ['color' => '#d97706', 'icon' => 'fas fa-exclamation-triangle'],
        'notice'    => ['color' => '#b59c1c', 'icon' => 'fas fa-info-circle'],
        'info'      => ['color' => '#0284c7', 'icon' => 'fas fa-info-circle'],
        'debug'     => ['color' => '#059669', 'icon' => 'fas fa-bug'],
    ],

    // Export settings (no external dependencies 

'channels' => [
    'daily' => [
        'driver' => 'daily',
        'path'   => storage_path('logs/laravel.log'),
        'level'  => env('LOG_LEVEL', 'debug'),
        'days'   => 14,
    ],
],

'alerts' => [
    'enabled'          => true,
    'window_minutes'   => 60,     // rolling look-back window
    'cooldown_minutes' => 15,     // minimum gap before re-alerting for same file + level

    'thresholds' => [
        'emergency' => 1,
        'critical'  => 1,
        'error'     => 50,
        'warning'   => 100,
    ],

    'channels' => [
        'mail'    => ['enabled' => true,  'to' => '[email protected]'],
        'slack'   => ['enabled' => true,  'webhook_url' => env('LOG_TRACKER_SLACK_WEBHOOK')],
        'discord' => ['enabled' => false, 'webhook_url' => env('LOG_TRACKER_DISCORD_WEBHOOK')],
        'webhook' => [
            'enabled' => false,
            'url'     => env('LOG_TRACKER_WEBHOOK_URL'),
            'method'  => 'POST',
            'headers' => ['Authorization' => 'Bearer token'],
        ],
    ],
],

'theme' => 'GlowStack', // or 'LiteFlow'
bash
php artisan vendor:publish --provider="Kssadi\LogTracker\LogTrackerServiceProvider" --tag="config"
bash
php artisan vendor:publish --provider="Kssadi\LogTracker\LogTrackerServiceProvider" --tag="views"
bash
php artisan log-tracker:check-alerts
bash
./vendor/bin/phpunit tests/Feature/CompareControllerTest.php