alpha-dev-team/logger
Composer 安装命令:
composer require alpha-dev-team/logger
包简介
Logger via db records, telegram and files. Based on Laravel logger.
README 文档
README
Requirements
- PHP v8.1+
Description
Logger via db records, telegram and files. Based on standard Laravel logger. It also utilizes the Monolog library. Plus, Alpha-Dev-Logger comes with a simple administration panel for reading, change status and delete log records.
Installation
First step is install Alpha-Dev-Logger via the Composer command
composer require alpha-dev-team/logger
Next important step is published configuration file logger-alpha.php
php artisan vendor:publish --tag=logger-config --force
Also need run migration for new logs table:
php artisan migrate
Configuration
General
Since Alpha-Dev-Logger based on standard Laravel logger, some configurations need to be made in logging.php in channels array. For convenience, all needed changes in logging.php contain in logger-alpha.php in channels array.
DB
Set in logging.php in channels (You can find it in logger-alpha.php in channels array):
'db' => [ 'driver' => 'custom', 'via' => \AlphaDevTeam\Logger\Logging\AlphaDevDBLogger::class, 'level' => env('LOG_LEVEL', 'debug'), ],
Telegram
If You want to get log errors to Telegram channel set in logging.php in channels (You can find it in logger-alpha.php in channels array):
'telegram' => [ 'driver' => 'custom', 'via' => \AlphaDevTeam\Logger\Logging\AlphaDevTelegramLogger::class, 'level' => env('LOG_LEVEL', 'debug'), ],
For using Telegram notifications it is necessary to determine and set telegram api bot and telegram channel name in Your .env file:
LOG_TELEGRAM_BOT_API=999999999:AAAAAAAsAAA9AaAAAaaaAaAaAaAAA99aAaa LOG_TELEGRAM_CHANNEL=telegram_channel
Also, You can make some changes for Telegram message view in logger-alpha.php.
Daily Files
If You want save log errors in files in json format, set in logging.php in channels (You can find it in logger-alpha.php in channels array):
'daily' => [ 'driver' => 'daily', 'path' => storage_path('logs/daily/laravel.log'), 'tap' => [\AlphaDevTeam\Logger\Logging\AlphaDevLogJson::class], 'level' => env('LOG_LEVEL', 'debug'), 'days' => 14, ],
Parameter days in daily array sets the retention period for files. You can set another.
General
Finally, make sure, that current log channel is stack in .env file.
LOG_CHANNEL=stack
And the last. Add to logging.php to array channels.stack.channels channels, that You will use:
'stack' => [ 'driver' => 'stack', 'channels' => ['daily', 'db', 'telegram'], 'ignore_exceptions' => false, ],
Panel
Alpha-Dev-Logger comes with a simple administration panel for reading, change status and delete log records. You can make some changes for panel rotes in logger-alpha.php.
Fresh Logs
For refresh logs db retrieved special command RefreshLogsTable. You can configure edge date time for soft delete records and edge date time for totally delete records in logger-alpha.php in db.remove_in_months
Also, You can add this command to Task Scheduling in App\Console\Kernel to schedule method. For example every month:
$schedule->command('refresh-logs:run')->monthly();
alpha-dev-team/logger 适用场景与选型建议
alpha-dev-team/logger 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 27 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 06 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 alpha-dev-team/logger 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 alpha-dev-team/logger 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 27
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 12
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-06-12