gdpro/gdpro-monolog
最新稳定版本:1.1.0
Composer 安装命令:
composer require gdpro/gdpro-monolog
包简介
Monolog integration for ZF2
README 文档
README
Introduction
The repository adds support for logging to Monolog to the Zend Framework 2.
Changelog
Requirements
Please see the composer.json file.
Installation
Run the following composer command:
$ composer require "gdpro/gdpro-monolog:~1.0"
Alternately, manually add the following to your composer.json, in
the require section:
"require": { "gdpro/gdpro-monolog": "^1.0" }
And then run composer update to ensure the module is installed.
Finally, add the module name to your project's config/application.config.php
under the modules key:
return array( /* ... */ 'modules' => array( /* ... */ 'GdproMonolog', ), /* ... */ );
Documentation
By Default the monolog logging will log your error event and add them to the log files
- data/log/route.error.log
- data/log/dispatch.error.log
- data/log/
Utilisation
Default Logger
$this->getServiceLocator()->get('gdpro-monolog_default')->addDebug('hello {contextvar}', ['contextvar' => 'world']);
Exception Logger
$this->getServiceLocator()->get('my_awesome_customized_logger')->addDebug('hello {contextvar}', ['contextvar' => 'world']);
/**
* @param MvcEvent $event
*/
public function onBootstrap(MvcEvent $event)
{
$eventManager = $event->getApplication()->getEventManager();
$moduleRouteListener = new ModuleRouteListener();
$moduleRouteListener->attach($eventManager);
$eventManager->attach(MvcEvent::EVENT_FINISH, [$this, 'onFinish']);
$eventManager->attach(MvcEvent::EVENT_RENDER_ERROR, [$this, 'onRenderError']);
$eventManager->attach(MvcEvent::EVENT_DISPATCH_ERROR, [$this, 'onDispatchError']);
}
public function onFinish(MvcEvent $event)
{
$services = $event->getApplication()->getServiceManager();
$services->get(CheckSlowResponseTimeListener::class);
$services->get(LogMemoryUsageListener::class);
}
public function onRenderError(MvcEvent $event)
{
$services = $event->getApplication()->getServiceManager();
$services->get(LogRenderErrorListener::class);
}
public function onDispatchError(MvcEvent $event)
{
$services = $event->getApplication()->getServiceManager();
$services->get(LogDispatchErrorListener::class);
}
统计信息
- 总下载量: 243
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 1
其他信息
- 授权协议: BSD-4-Clause
- 更新时间: 2015-07-02