shaonmajumder/log-viewer

Reusable Laravel log viewer package with filtering, context expansion, and download support.

Maintainers

Package info

github.com/ShaonMajumder/log-viewer

Language:Blade

pkg:composer/shaonmajumder/log-viewer

Statistics

Installs: 88

Dependents: 0

Suggesters: 0

Stars: 1

Open Issues: 0

v0.0.29 2026-05-09 23:50 UTC

README

๐Ÿ”ฅ Beautiful โ€ข Secure โ€ข Fast โ€ข Real-Time Friendly Laravel Log Viewer

โœจ Features

๐Ÿ›ก๏ธ Security First

  • ๐Ÿ” Admin-protected routes
  • ๐Ÿšซ Path traversal protection
  • ๐Ÿง  Custom authorization callback
  • ๐Ÿงฑ Middleware configurable

๐Ÿ“„ Smart Log Discovery

Automatically detects:

  • laravel.log
  • laravel-YYYY-MM-DD.log
  • rotated log files
  • multiple Laravel log patterns

๐ŸŽจ Beautiful Log Highlighting

Color-coded levels:

Level Highlight
โŒ ERROR Red
โš ๏ธ WARNING Yellow
โ„น๏ธ INFO Blue
๐Ÿ› DEBUG Gray

๐ŸŒ™ Theme Support

Built-in dark theme options:

  • Dark Ink (default)
  • Dark Graphite
  • Dark Forest

Theme can be changed directly from the viewer header, and the selection is saved in browser localStorage.

๐Ÿ” Advanced Filtering

  • ๐Ÿ”Ž Full-text search
  • ๐ŸŽฏ Level filtering
  • ๐Ÿ“Œ Match-only mode
  • โšก Instant filtering

๐Ÿง  Inline Context Expansion

Expand surrounding lines around matches:

  • No Context
  • ยฑ2
  • ยฑ5
  • ยฑ10
  • ยฑ20

Perfect for debugging stack traces and exceptions.

โฑ๏ธ Tail Mode Support

View latest logs instantly:

  • No Limit
  • 100
  • 300
  • 500
  • 1000
  • 2000

๐Ÿ“ฅ Filtered Download

Download:

  • full logs
  • filtered results
  • contextual output

๐Ÿ”„ Auto Refresh Controls

  • Live refresh
  • Pause on scroll
  • Smart refresh handling
  • Developer-friendly UX

๐Ÿ“ฆ Installation

โœ… Packagist (Recommended)

composer require shaonmajumder/log-viewer

๐Ÿงช Local Development (Path Repository)

Add to your Laravel app:

{
  "repositories": [
    {
      "type": "path",
      "url": "../log-viewer"
    }
  ],
  "require": {
    "shaonmajumder/log-viewer": "*@dev"
  }
}

Then run:

composer update shaonmajumder/log-viewer

โš™๏ธ Publish Configuration

php artisan vendor:publish --tag=log-viewer-config

Publish views:

php artisan vendor:publish --tag=log-viewer-views

๐ŸŒ Default Routes

Route Description
/log-viewer Main log viewer
/log-viewer/download Download logs

๐Ÿ”ง Configuration

Published config:

config/log-viewer.php

Important Options

Option Description
route_prefix Route prefix
middleware Route middleware
layout Blade layout
heading Viewer heading

๐Ÿ”’ Access Control

Default behavior is fixed: only logged-in users can access /log-viewer.

  • If user is not logged in, package redirects to /login.
  • If user is logged in, package allows access.
  • This access rule is enforced in package controller logic and does not depend on per-project auth config toggles.

๐Ÿ–ผ๏ธ Screenshots

![Main Viewer](assets/screenshots/log-viewer-main.png)

![Context Expansion](assets/screenshots/log-viewer-context.png)

![Auto Refresh](assets/screenshots/log-viewer-refresh.png)

๐Ÿงฑ Package Structure

src/
โ”œโ”€โ”€ Http/
โ”‚   โ””โ”€โ”€ Controllers/
โ”‚       โ””โ”€โ”€ LaravelLogController.php
โ”‚
โ”œโ”€โ”€ LaravelLogViewerServiceProvider.php

routes/
โ””โ”€โ”€ web.php

config/
โ””โ”€โ”€ log-viewer.php

resources/
โ””โ”€โ”€ views/
    โ””โ”€โ”€ index.blade.php

๐Ÿ›ก๏ธ Security Notes

โš ๏ธ Never expose production logs publicly.

Recommended:

  • protect with authentication
  • enforce admin authorization
  • restrict access internally only

๐Ÿš€ Built For

โœ… Production Laravel apps
โœ… Admin panels
โœ… DevOps dashboards
โœ… Debugging tools
โœ… Monitoring systems
โœ… Internal engineering tools

โค๏ธ Why This Package?

Most Laravel log viewers are:

  • outdated
  • unsafe
  • slow
  • ugly
  • missing filtering/context tools

This package focuses on:

โœ… Developer Experience
โœ… Security
โœ… Performance
โœ… Clean UI
โœ… Real-world production usage

๐Ÿ“Œ Compatibility

Framework Supported
Laravel 9 โœ…
Laravel 10 โœ…
Laravel 11 โœ…
PHP Version Supported
PHP 8+ โœ…

๐Ÿ“„ License

MIT ยฉ Shaon Majumder

โญ Support The Project

If this package helps you:

  • โญ Star the repository
  • ๐Ÿด Fork it
  • ๐Ÿ› Report issues
  • ๐Ÿš€ Contribute improvements

Built with โค๏ธ for Laravel developers