samkitano/laralog
Composer 安装命令:
composer require samkitano/laralog
包简介
A Laravel Logs manager
README 文档
README
A log viewer for Laravel
Laralog breaks down log files created by Monolog in your Laravel app into an object, to ease up the reading of those files.
REQUIREMENTS
- PHP >= 7.1.3
- Laravel 5.7.*
- At this time, logging channel should be configured to 'stack' and 'daily' at
config\logging.php(Laravel defaults)
INSTALLATION
composer require samkitano/laralog
CONFIGURATION
Publish configuration (optional):
php artisan vendor:publish --tag=laralog
The configuration file contains detailed descriptions of all and each entry.
USAGE
Results in these examples are based on the included files for testing at laralog\storage\logs
To fetch a List (array) with the names of the existing log files:
$list = Laralog::list(); dump($list);
Result:
array:6 [ 0 => "\packages\laralog\storage\logs\laravel-2017-06-10.log" 1 => "\packages\laralog\storage\logs\laravel-2017-12-02.log" 2 => "\packages\laralog\storage\logs\laravel-2018-11-27.log" 3 => "\packages\laralog\storage\logs\laravel-2018-12-07.log" 4 => "\packages\laralog\storage\logs\laravel-2018-12-17.log" 5 => "\packages\laralog\storage\logs\laravel-2018-12-27.log" ]
To fetch a List (array) with the dates of the existing log files:
$dates = Laralog::dates(); dump($dates);
Result:
array:6 [ 0 => "2017-06-10" 1 => "2017-12-02" 2 => "2018-11-27" 3 => "2018-12-07" 4 => "2018-12-17" 5 => "2018-12-27" ]
To fetch a List (array) with the grouped dates of the existing log files:
$groupped = Laralog::group(); dump($groupped);
Result:
array:2 [ 2017 => array:2 [ "Jun" => array:1 [ 0 => "10" ] "Dec" => array:1 [ 0 => "02" ] ] 2018 => array:2 [ "Nov" => array:1 [ 0 => "27" ] "Dec" => array:3 [ 0 => "07" 1 => "17" 2 => "27" ] ] ]
To process a log:
Use Laralog::latest() to process the most recent log, or the
Laralog::process() command which accepts as an argument:
- [null]. If no argument is passed, the most recent log will be processed;
- [string] a name. i.e. 'laravel-2017-06-10.log';
- [string] a date. i.e. '2017-Jun-10', or '2017-6-10';
- [object] a Carbon object. i.e. Carbon::create(2017, 6, 10);
$log = Laralog::process('2017-Jun-10'); dump($log);
Result (some output was shortened for readability):
"2017-06-10" => array:4 [ "name" => "laravel-2017-06-10.log" "path" => "F:\packages\laralog\storage\logs\laravel-2017-06-10.log" "length" => 1 "entries" => array:1 [ 0 => array:6 [ "raw_header" => "[2018-12-27 12:29:27] local.ERROR: Database (/local_dev/www/sam/database/sk.sqlite) does not exist. ...)" "datetime" => "2018-12-27 12:29:27" "env" => "local" "level" => "error" "error" => "Illuminate\\Database\\QueryException(code: 0): Database (/local_dev/www/sam/database/sk.sqlite) does not exist. ..." "stack" => """ \n [stacktrace]\n #0 F:\\www\\sam\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Connection.php(624): Illuminate\\Database\\Connection->runQueryCallback('select * from \"...', Array, Object(Closure))\n #1 F:\\www\\sam\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Connection.php(333): Illuminate\\Database\\Connection->run('select * from \"...', Array, Object(Closure))\n #2 F:\\www\\sam\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Query\\Builder.php(2082): Illuminate\\Database\\Connection->select('select * from \"...', Array, true)\n ... ... #58 {main}\n "} \n """ ] ] ] ]
TODO
- Allow to fetch logs other than those in the local filesystem
- Allow other logging config settings
- A better abstraction for the breakdown process
LICENSE
This package is open-source software, licensed under the MIT license
samkitano/laralog 适用场景与选型建议
samkitano/laralog 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 24 次下载、GitHub Stars 达 1, 最近一次更新时间为 2018 年 12 月 31 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 samkitano/laralog 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 samkitano/laralog 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 24
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-12-31