shaonmajumder/log-viewer 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

shaonmajumder/log-viewer

Composer 安装命令:

composer require shaonmajumder/log-viewer

包简介

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

README 文档

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

统计信息

  • 总下载量: 88
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: Blade

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-09-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固