Skip to content

stepanenko3/laravel-log-viewer

Repository files navigation

Laravel Log Viewer

Latest Version on Packagist Total Downloads License

Description

Log Viewer version without UI and with some modifications

Features

  • Without UI (Without frontend)
  • Support subfolders
  • Files sorting by name, size, modification time
  • Using custom pagination

Requirements

  • php: >=8.0

Installation

composer require stepanenko3/laravel-log-viewer

Usage

use Stepanenko3\LaravelLogViewer\LogViewer;
use Stepanenko3\LaravelLogViewer\LogFile;

// Getting all log files
LogViewer::getFiles();

// Get specific log file by name
LogViewer::getFile('laravel.log');

// Clear cache of all files
LogViewer::clearCacheAll();

// Download specific log file by name
LogFile::download('laravel.log');

// Delete specific log file by name
LogFile::delete('laravel.log');

// Clear cache for specific log file by name
LogFile::clearCache('laravel.log');

// Query logs
LogFile::get(
    selectedFileName: 'laravel.log', // File name
    query: 'exception[0-9]+', // Filter logs by regex query string
    selectedLevels: ['warning', 'alert'], // Filter logs by level
    page: 2, // Page
    perPage: 25, // Logs per page
    direction: LogFile::NEWEST_FIRST, // Logs order. NEWEST_FIRST::OLDEST_FIRST,
);

Credits

Contributing

Thank you for considering contributing to this package! Please create a pull request with your contributions with detailed explanation of the changes you are proposing.

License

This package is open-sourced software licensed under the MIT license.