hexanet/monolog-extra-bundle
最新稳定版本:v3.0.2
Composer 安装命令:
composer require hexanet/monolog-extra-bundle
包简介
Symfony bundle with extra processors and logger to log request/response
README 文档
README
Symfony bundle with extra processors and logger to log request/response.
Installation
Applications that use Symfony Flex
Open a command console, enter your project directory and execute:
$ composer require hexanet/monolog-extra-bundle
Applications that don't use Symfony Flex
Step 1: Download the Bundle
Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:
$ composer require hexanet/monolog-extra-bundle
This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.
Step 2: Enable the Bundle
Then, enable the bundle by adding it to the list of registered bundles
in the app/AppKernel.php file of your project:
<?php // app/AppKernel.php // ... class AppKernel extends Kernel { public function registerBundles() { $bundles = array( // ... new Hexanet\Common\MonologExtraBundle\HexanetMonologExtraBundle(), ); // ... } // ... }
Usage
Processors
The bundle provides several processors:
- User
- Session ID
- UID
- Additions
User
The UserProcessor add data about the current user in each log entry.
hexanet_monolog_extra: processor: user: true
The default provider returns:
- anonymous when no user is logged
- the username of the current logged user
- cli
You can create your own provider by creating a service that implements Hexanet\Common\MonologExtraBundle\Provider\User\UserProviderInterface.
hexanet_monolog_extra: provider: user: your_own_provider_service_id
Session ID
Add the session id in each log entry.
hexanet_monolog_extra: processor: session_id: true
You can create your own provider by creating a service that implements Hexanet\Common\MonologExtraBundle\Provider\Session\SessionIdProviderInterface.
hexanet_monolog_extra: provider: session_id: your_own_provider_service_id
UID
Add an unique identifier for the request in each log entry.
hexanet_monolog_extra: processor: uid: true
The bundle comes with 2 providers:
- UniqidProvider (default): use
uniqid - ApacheUniqueIdProvider: get from environment, need mod_unique_id of Apache
You can create your own provider by creating a service that implements Hexanet\Common\MonologExtraBundle\Provider\Uid\UidProviderInterface.
hexanet_monolog_extra: provider: uid: your_own_provider_service_id
Additions
Add custom data in each log entry.
hexanet_monolog_extra: processor: additions: type: symfony application: the best symfony application locale: "%locale%" environment: "%kernel.environment%"
Loggers
On request
Create a log entry with the request data.
On response
Create a log entry with the response data.
On console exception
Create a log entry when an exception occurs in console.
Add UID to response
Add the UID of the previous processor in the response headers.
HTTP/1.1 302 Found
X-UID: 57c5f5e842b10
Configuration reference
Configuration reference for a reference on the available configuration options.
Credits
Developed by Hexanet.
License
MonologExtraBundle is licensed under the MIT license.
hexanet/monolog-extra-bundle 适用场景与选型建议
hexanet/monolog-extra-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 27.54k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2015 年 11 月 19 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「log」 「logging」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 hexanet/monolog-extra-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 hexanet/monolog-extra-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 hexanet/monolog-extra-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Zend Framework module that sets up Monolog for logging in applications.
Asynchronous Sentry for Symfony - Fire and forget
Stackdriver handler for Monolog (codeinternetapplications/monolog-stackdriver Fork).
Laravel 5.x.x library for integration Monolog Sentry
High-performance, zero-dependency PSR-3 logger for MonkeysLegion with structured logging, handlers, processors, and PHP 8.4 features.
Pacote simplificado para persistência de logs
统计信息
- 总下载量: 27.54k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 31
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-11-19