Giter VIP home page Giter VIP logo

laravel-log-viewer's Introduction

Dcat Laravel Log Viewer

StyleCI

Dcat Log Viewer是一个Laravel日志查看工具,支持大文件日志的查看和搜索功能,更改自laravel-admin-extensions/log-viewer

功能

  • 支持多层级目录
  • 支持查看大文件日志
  • 支持日志关键词检索
  • 支持多层级目录文件名称搜索
  • 支持下载功能
  • 支持分页
  • 支持手机页面

环境

  • PHP >= 7
  • laravel >= 5.5

安装

composer require dcat/laravel-log-viewer

发布配置文件,此步骤可省略

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

然后访问 http://hostname/dcat-logs 即可

配置文件

return [
    'route' => [
        // 路由前缀
        'prefix'     => 'dcat-logs',
         // 命名空间
        'namespace'  => 'Dcat\LogViewer',
         // 中间件
        'middleware' => [],
    ],

    // 日志目录
    'directory' => storage_path('logs'),

    // 搜索页显示条目数(搜索后不分页,所以这个参数可以设置大一些)
    'search_page_items' => 500,

    // 默认每页条目数
    'page_items' => 30,
];

License

The MIT License (MIT).

laravel-log-viewer's People

Contributors

dememory avatar jqhph avatar lilashih avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

laravel-log-viewer's Issues

日志目录读取问题 & Carbon 【error:Trailing data】

LogViewer.php :

public function __construct($basePath, $dir, $file = null)
{
$this->basePath = trim($basePath, '/');
$this->currentDirectory = trim($dir, '/');
$this->file = $file;
$this->files = new Filesystem();
}

trim 过滤掉左 “/” 符号 导致无法正确读取目录 报:
The "Applications/MAMP/htdocs/***/storage/logs" directory does not exist.

log.blade.php :
{{ \Carbon\Carbon::create(date('Y-m-d H:i:s', filectime($filePath)))->diffForHumans() }}

Carbon::create格式错误报:
ErrorException (E_ERROR)
Trailing data (View: /Applications/MAMP/htdocs/***/vendor/dcat/laravel-log-viewer/resources/view/log.blade.php)
Previous exceptions
Trailing data (0)

建议替换为:
{{ \Carbon\Carbon::createFromFormat('Y-m-d H:i:s', date('Y-m-d H:i:s', filectime($filePath)))->diffForHumans() }}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.