LogViewer

repository·master·Indexed 25 days ago

https://github.com/arcanedev/logviewer

A Laravel package providing a UI and API for managing, viewing, paginating, filtering, downloading, and deleting application log files. Compatible with Laravel versions 5.x through 11.x, it supports the daily log channel, multiple localizations, and customizable themes (Bootstrap 3 and 4). Includes Artisan commands for checking requirements, clearing logs, and viewing statistics, as well as Log and LogCollection entities for programmatic access to log data.

Tokens
5.9K
Snippets
14
Records
54
Agent score
81%

What's inside arcanedev-logviewer

  1. Overview of LogViewer

    master
    LogViewer is a Laravel package designed to manage and track log files. It provides a ready-to-use interface for viewing, paginating, filtering, downloading, and deleting logs. It is compatible with Laravel versions 5.x through 11.x and can be used both as a UI dashboard and as an API.
  2. LogViewer Features

    master

    LogViewer provides several out-of-the-box capabilities for log management:

    • Ready to use: Includes Views, Routes, and Controllers automatically (no need to publish assets).
    • Log Management: View, paginate, filter, download, and delete logs.
    • Customization: Load custom logs storage paths and customize log level icons (uses Font Awesome by default).
    • Organization: Logs are grouped by dates and levels, with a logs menu/tree generator included.
    • Performance: Optimized to work well with large log files.
    • Developer Experience: IDE friendly and well-documented.
    • Localization: Supports localized log levels in multiple languages.
  3. Install LogViewer via Composer

    master

    Install the package using Composer. You must select a version compatible with your Laravel installation based on the version compatibility table in the documentation.

    Use the syntax composer require arcanedev/log-viewer:{x.x} where x.x is the compatible version.

    composer require arcanedev/log-viewer:~4.6.0
  4. Register LogViewer Service Provider

    master

    If you are using Laravel version < 5.5, you must manually register the service provider in the providers array within config/app.php. If you are using Laravel >= 5.5, this step is handled automatically and can be skipped.

    Note: You do not need to register the LogViewer facade; it is registered automatically.

    'providers' => [
        ...
        Arcanedev\LogViewer\LogViewerServiceProvider::class,
    ],
  5. Configure the log files pattern

    master

    Define the naming convention for your log files using the pattern array. This includes a prefix, a date regex pattern, and an extension.

    It is recommended to use the constants provided by Arcanedev\LogViewer\Contracts\Utilities\Filesystem for consistency.

    use Arcanedev\LogViewer\Contracts\Utilities\Filesystem;
    
    return [
        'pattern'       => [
            'prefix'    => Filesystem::PATTERN_PREFIX,    // 'laravel-'
            'date'      => Filesystem::PATTERN_DATE,      // '[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]'
            'extension' => Filesystem::PATTERN_EXTENSION, // '.log'
        ],
    ];
  6. Customize log level colors

    master

    The colors.levels array allows you to map specific log levels to hex color codes for the UI.

    return [
        'colors' => [
            'levels' => [
                'empty'     => '#D1D1D1',
                'all'       => '#8A8A8A',
                'emergency' => '#B71C1C',
                'alert'     => '#D32F2F',
                'critical'  => '#F44336',
                'error'     => '#FF5722',
                'warning'   => '#FF9100',
                'notice'    => '#4CAF50',
                'info'      => '#1976D2',
                'debug'     => '#90CAF9',
            ],
        ],
    ];