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 [
    /*
    |--------------------------------------------------------------------------
    | Route Configuration
    |--------------------------------------------------------------------------
    */
    'route_prefix' => 'log-tracker',
    'middleware' => ['web', 'auth'],

    /*
    |--------------------------------------------------------------------------
    | Theme Selection
    |--------------------------------------------------------------------------
    */
    'theme' => 'GlowStack', // Options: 'LiteFlow', 'GlowStack'

    /*
    |--------------------------------------------------------------------------
    | Display Settings
    |--------------------------------------------------------------------------
    */
    'per_page' => 50,
    'max_file_size' => 50, // MB

    /*
    |--------------------------------------------------------------------------
    | Feature Permissions
    |--------------------------------------------------------------------------
    */
    'allow_delete' => true,
    'allow_download' => true,

    /*
    |--------------------------------------------------------------------------
    | Export Configuration
    |--------------------------------------------------------------------------
    */
    'export' => [
        'enabled' => true,
        'formats' => [
            'csv' => [
                'enabled' => true,
                'description' => 'Excel-compatible CSV format'
            ],
            'json' => [
                'enabled' => true,
                'description' => 'Structured JSON with metadata'
            ],
            'excel' => [
                'enabled' => true,
                'description' => 'Native Excel XML format'
            ],
            'pdf' => [
                'enabled' => true,
                'description' => 'Print-ready HTML report'
            ],
        ],
        'limits' => [
            'max_entries' => 50000,
            'max_file_size_mb' => 50,
            'timeout_seconds' => 300,
        ],
        'storage' => [
            'cleanup_after_days' => 7,
        ],
    ],
];

LOG_CHANNEL=daily  # Recommended for structured logging
LOG_LEVEL=debug    # Set the minimum log level to be recorded


'daily' => [
    'driver' => 'daily',
    'path' => storage_path('logs/laravel.log'),
    'level' => env('LOG_LEVEL', 'debug'),
    'days' => 30, // Keep logs for the last 30 days
],

'theme' => 'GlowStack', // Options: 'LiteFlow', 'GlowStack'

'export' => [
    'enabled' => true,
    'formats' => [
        'csv' => [
            'enabled' => true,
            'description' => 'Excel-compatible CSV format'
        ],
        'json' => [
            'enabled' => true,
            'description' => 'Structured JSON with metadata'
        ],
        'excel' => [
            'enabled' => true,
            'description' => 'Native Excel XML format'
        ],
        'pdf' => [
            'enabled' => true,
            'description' => 'Print-ready HTML report'
        ],
    ],
    'limits' => [
        'max_entries' => 50000,        // Maximum records per export
        'max_file_size_mb' => 50,      // Max file size for processing
        'timeout_seconds' => 300,       // Export timeout
    ],
    'storage' => [
        'cleanup_after_days' => 7,     // Auto-cleanup exported files
    ],
],

// Dashboard
GET /log-tracker

// Log file list
GET /log-tracker/log-file

// View specific log file
GET /log-tracker/{logName}

// Download log file
GET /log-tracker/download/{logName}

// Export log file
POST /log-tracker/export/{logName}

// Delete log file (if enabled)
POST /log-tracker/delete/{logName}

'middleware' => ['web', 'auth'],