laralogapp/laralog
Composer 安装命令:
composer require laralogapp/laralog
包简介
A package to work with laralog.app to allow easy access to your app's logs.
README 文档
README
This package is can be used in conjunction with https://laralog.app to enable free, simple and central remote viewing for Laravel logs.
The idea of this package is to provide a central interface where you can view your logs for all of your Laravel applications in an easy to read, responsive format.
It's not meant to replace services such as papertrail. https://laralog.app never stores log data, it accesses your log data (how much is up to you) over HTTP protocol and provides an interface to read, search and filter your Laravel logs for as many Laravel applications as you need.
Installation
Require laralogapp/laralog package and update your dependencies.
$ composer require laralogapp/laralog
If you're using Laravel 5.4 and below you need to add the service provider to your config/app.php providers array otherwise autodiscovery is used.
Laralog\Laralog\LaralogServiceProvider::class
Publish the package's configuration
$ php artisan vendor:publish --provider="Laralog\Laralog\LaralogServiceProvider"
Configuration
[REQUIRED] auth_token - This is a shared secret between your application and https://laralog.app's interface. You need to set this to either a custom key or to the one generated when creating a new application at https://laralog.app.
max_file_size - The maximum log file size allowed
truncated_logs - Truncate the log to the maximum file size if log exceeds the maximum file size, the data will be fetched from the end of the file (meaning the log data will be the most recent enteries).
ip_whitelist - IPs allowed to access log data, by default this is empty, meaning all IPs can access data. But if you wish to limit the IPs which can access your data you can do so using this option. (Good to use if you're worried about the security of your tokens).
Notes
Laralog accesses your log data through the client, so your log data will never touch Laralog's server. The exception to this rule is for HTTP connections. HTTP connections are proxied through Laralog's server to prevent browsers throwing mixed content errors.
- Completely Free
- Supports Laravel 5.1+
- Connect with HTTP or HTTPS
- Limit who can view logs by whitelisting IPs
- Connect to local applications
Write your own interface
This package doesn't have to be used with https://laralog.app. Feel welcome to use this package's json endpoints to write your own front end to view and manage logs.
Endpoint
GET /laralog/available/logs
Example Successful Response - 200
size is in bytes
{
"files": [
{
"size": 293316,
"basename": "laravel-2018-10-10.log"
},
{
"size": 1665518042,
"basename": "laravel-big-log.log"
},
{
"size": 267207,
"basename": "laravel.log"
}
]
}
Endpoint
GET /laralog/get/log
Parameters
log_basename - the basename of the log to fetch data for
Example Successful Response - 200
Note - each line of the stacktrace is separated by a new line.
{
"log_entries": [
{
"date": "2018-11-04 15:58:56",
"environment": "local",
"level": "ERROR",
"message": "fread(): Length parameter must be greater than 0 {\"exception\":\"[object] (ErrorException(code: 0): fread(): Length parameter must be greater than 0 at LaraLog/src/LogParser.php:81)\n",
"stacktrace": "\n#0 [internal function]: Illuminate\\\\Foundation\\\\Bootstrap\\\\HandleExceptions->handleError(2, 'fread(): Length...', '...', 81, Array)\n#1 LaraLog/src/LogParser.php(81): fread(Resource id #252, 0)\n#2 LaraLog/src/LogController.php(51): Laralog\\\\Laralog\\\\LogParser->truncatedLogContents('...')\n#3 [internal function]: Laralog\\\\Laralog\\\\LogController->getLog()\n#4 vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): call_user_func_array(Array, Array)\n#\n..."
},
...
]
}
laralogapp/laralog 适用场景与选型建议
laralogapp/laralog 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 17 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 11 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 laralogapp/laralog 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 laralogapp/laralog 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 17
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 7
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-11-18