定制 lumisys/log-viewer-bundle 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

lumisys/log-viewer-bundle

最新稳定版本:1.2.5

Composer 安装命令:

composer require lumisys/log-viewer-bundle

包简介

A log viewer bundle for Symfony 6 and up

README 文档

README

License Minimum PHP Version Minimum Symfony Version Vuejs codecov Run tests

Log viewer for Symfony

Inspired by opcodesio/log-viewer for Laravel log-viewer

Log Viewer: a bundle for your Symfony app. It provides a user-friendly UI to read, filter and search log files.

Out of the box it will read your Monolog logs in the var/log directory, but can be configured to read logs from any directory.

Features

  • 📂 View all the Monolog logs in the %kernel.logs_dir% directory,
  • 📂 View other types of logs - Apache, Nginx, or custom logs,
  • 🔍 Search the logs,
  • 🔍 Filter by log level (error, info, debug, etc.), by channel, date range or log content inclusion or exclusion,
  • 🔍 Search multiple log files at once,
  • 🌑 Dark mode,
  • 🖥️ Multiple host support,
  • 💾 Download or delete log files from the UI,
  • ☎️ API access for folders, files & log entries,

Getting started

Requirements

  • PHP 8.1+
  • Symfony 6.0+ or 7.0+

Installation

Use composer.

composer require fdekker/log-viewer-bundle

If you don't use Symfony Flex, you'll need to manually enable the bundle:

# /config/bundles.php
return [
    // ...
    FD\LogViewer\FDLogViewerBundle::class => ['all' => true],
];

And add the route by creating file /config/routes/fd_log_viewer.php:

<?php
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;

return static function (RoutingConfigurator $routingConfigurator): void {
    $routingConfigurator->import('.', 'fd_symfony_log_viewer')->prefix('/log-viewer');
};

Ensure access to your logs are secure by adding the line below to /config/packages/security.php:

return static function (SecurityConfig $security): void {
    ...
    $security->accessControl()->path('^/log-viewer')->roles(['ROLE_ADMIN']);
};

After installing the package, publish the front-end assets by running:

php bin/console assets:install

Usage

Once the installation is complete, you will be able to access Log Viewer directly in your browser.

By default, it is available at: /log-viewer on your domain.

Configuration

Default configuration: (Configuration reference)

fd_log_viewer:
    home_route: null

    log_files:
        monolog:
            type: monolog
            name: Monolog
            finder:
                in: "%kernel.logs_dir%"
                name: "*.log"
                depth: '== 0'
                ignoreUnreadableDirs: true
                followLinks: false
            downloadable: false
            deletable: false
            start_of_line_pattern: '/^\[\d{4}-\d{2}-\d{2}[^]]*]\s+\S+\.\S+:/'
            log_message_pattern: '/^\[(?P<date>[^\]]+)\]\s+(?P<channel>[^\.]+)\.(?P<severity>[^:]+):\s+(?P<message>.*)\s+(?P<context>[[{].*?[\]}])\s+(?P<extra>[[{].*?[\]}])\s+$/s'
            date_format: "Y-m-d H:i:s"

    hosts:
        localhost:
            name: Local
            host: null

Read more:

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-08-16