2017 © Pedro Peláez
 

library gdpro-monolog

Monolog integration for ZF2

image

gdpro/gdpro-monolog

Monolog integration for ZF2

  • Thursday, April 20, 2017
  • by garygitton
  • Repository
  • 1 Watchers
  • 2 Stars
  • 166 Installations
  • PHP
  • 1 Dependents
  • 1 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 4 % Grown

The README.md

Gdpro Monolog

Introduction

The repository adds support for logging to Monolog to the Zend Framework 2., (*1)

Changelog

doc/CHANGELOG.md, (*2)

Requirements

Please see the composer.json file., (*3)

Installation

Run the following composer command:, (*4)

$ composer require "gdpro/gdpro-monolog:~1.0"

Alternately, manually add the following to your composer.json, in the require section:, (*5)

"require": {
    "gdpro/gdpro-monolog": "^1.0"
}

And then run composer update to ensure the module is installed., (*6)

Finally, add the module name to your project's config/application.config.php under the modules key:, (*7)

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/, (*8)

Utilisation

Default Logger

$this->getServiceLocator()->get('gdpro-monolog_default')->addDebug('hello {contextvar}', ['contextvar' => 'world']); , (*9)

Exception Logger

$this->getServiceLocator()->get('my_awesome_customized_logger')->addDebug('hello {contextvar}', ['contextvar' => 'world']); , (*10)


/** * @param MvcEvent $event */ public function onBootstrap(MvcEvent $event) { $eventManager = $event->getApplication()->getEventManager(); $moduleRouteListener = new ModuleRouteListener(); $moduleRouteListener->attach($eventManager);
, (*11)

$eventManager->attach(MvcEvent::EVENT_FINISH, [$this, 'onFinish']); $eventManager->attach(MvcEvent::EVENT_RENDER_ERROR, [$this, 'onRenderError']); $eventManager->attach(MvcEvent::EVENT_DISPATCH_ERROR, [$this, 'onDispatchError']); }, (*12)

public function onFinish(MvcEvent $event) { $services = $event->getApplication()->getServiceManager(); $services->get(CheckSlowResponseTimeListener::class); $services->get(LogMemoryUsageListener::class); }, (*13)

public function onRenderError(MvcEvent $event) { $services = $event->getApplication()->getServiceManager(); $services->get(LogRenderErrorListener::class); }, (*14)

public function onDispatchError(MvcEvent $event) { $services = $event->getApplication()->getServiceManager(); $services->get(LogDispatchErrorListener::class); } , (*15)

The Versions

02/03 2016

dev-develop

dev-develop

Monolog integration for ZF2

  Sources   Download

BSD-4-Clause

The Requires

 

The Development Requires

02/03 2016

1.0.1

1.0.1.0

Monolog integration for ZF2

  Sources   Download

BSD-4-Clause

The Requires

 

The Development Requires

02/03 2016

1.0.0

1.0.0.0

Monolog integration for ZF2

  Sources   Download

BSD-4-Clause

The Requires

 

The Development Requires