Download the PHP package gdpro/gdpro-monolog without Composer
On this page you can find all versions of the php package gdpro/gdpro-monolog. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download gdpro/gdpro-monolog
More information about gdpro/gdpro-monolog
Files in gdpro/gdpro-monolog
Package gdpro-monolog
Short Description Monolog integration for ZF2
License BSD-4-Clause
Informations about the package gdpro-monolog
Gdpro Monolog
Introduction
The repository adds support for logging to Monolog to the Zend Framework 2.
Changelog
doc/CHANGELOG.md
Requirements
Please see the composer.json file.
Installation
Run the following composer
command:
Alternately, manually add the following to your composer.json
, in
the require
section:
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:
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); }