PHP code example of ibrahim-eng12 / log-owl

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

    

ibrahim-eng12 / log-owl example snippets


return [
    // URL prefix for log viewer routes
    'route_prefix' => 'logs',

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

    // Path to log files
    'log_path' => storage_path('logs'),

    // Logs per page
    'per_page' => 25,

    // Restrict to specific users (empty = all authenticated)
    'allowed_users' => [],

    // Allow clearing log files
    'allow_clear' => true,

    // Allow downloading log files
    'allow_download' => true,

    // Default locale (null = use app locale)
    'locale' => null,

    // Available locales for the language switcher
    'available_locales' => [
        'en' => 'English',
        'ar' => 'Arabic',
    ],
];

'locale' => 'ar', // Set Arabic as default

'available_locales' => [
    'en' => 'English',
    'ar' => 'Arabic',
    'fr' => 'French',
],

use Ibrah\LaravelLogViewer\Services\LogParser;

class CustomLogParser extends LogParser
{
    protected array $errorPatterns = [
        // Add your custom patterns (pattern => translation_key)
        'MyCustomException' => 'my_custom_error',
        // ... parent patterns will be inherited
    ];
}

// resources/lang/vendor/log-viewer/en/log-viewer.php
'error_types' => [
    'my_custom_error' => [
        'type' => 'Custom Error',
        'description' => 'Description of the error.',
        'solutions' => [
            'Solution 1',
            'Solution 2',
        ],
    ],
    // ... other error types
],

$this->app->singleton(LogParser::class, CustomLogParser::class);
bash
php artisan vendor:publish --tag=log-viewer-config
bash
php artisan vendor:publish --tag=log-viewer-views
bash
php artisan vendor:publish --tag=log-viewer-lang
bash
php artisan vendor:publish --tag=log-owl-assets
bash
php artisan vendor:publish --tag=log-viewer-lang
bash
php artisan vendor:publish --tag=log-viewer-views