antidot-fw/logger
Composer 安装命令:
composer require antidot-fw/logger
包简介
Anti.Framework logger adapter library
README 文档
README
Application PSR-15 logger middleware:
- RequestLoggerMiddleware
- ExceptionLoggerMiddleware
Installation
Require package with composer package manager.
composer require antidot-fw/logger
Add both Middleware to your Pipeline
<?php // with Antidot Framework, Zend Expressive or Zend Stratigility $app->pipe(\Antidot\Logger\Application\Http\Middleware\ExceptionLoggerMiddleware::class); $app->pipe(\Antidot\Logger\Application\Http\Middleware\RequestLoggerMiddleware::class);
Using Zend Config Aggregator
It installs the library automatically
To use both middlewares in Zend Expressive you need to create factory classes
<?php // src/App/Container/ExceptionLoggerMiddlewareFactory.php namespace App\Container; use Antidot\Logger\Application\Http\Middleware\ExceptionLoggerMiddleware; use Psr\Container\ContainerInterface; use Psr\Log\LoggerInterface; class ExceptionLoggerMiddlewareFactory { public function __invoke(ContainerInterface $container) { return new ExceptionLoggerMiddleware($container->get(LoggerInterface::class)); } }
<?php // src/App/Container/RequestLoggerMiddlewareFactory.php namespace App\Container; use Antidot\Logger\Application\Http\Middleware\RequestLoggerMiddleware; use Psr\Container\ContainerInterface; use Psr\Log\LoggerInterface; class RequestLoggerMiddlewareFactory { public function __invoke(ContainerInterface $container) { return new RequestLoggerMiddleware($container->get(LoggerInterface::class)); } }
统计信息
- 总下载量: 722
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 1
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: BSD-2-Clause
- 更新时间: 2019-04-07