2017 © Pedro Peláez
 

library logger

An Event-driven Logging module for Zend Framework 2

image

coogle/logger

An Event-driven Logging module for Zend Framework 2

  • Friday, January 31, 2014
  • by coogle
  • Repository
  • 1 Watchers
  • 2 Stars
  • 54 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 1 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

ZF2 Logger Module

Introduction

This is a relatively simple Logger Module for ZF2. It attaches to the 'log' event allowing it to capture logging events from any module that triggers that event., (*1)

Configuration

The logger class has the following configuration values available to it under the logger key as shown:, (*2)

  array(
      'logger' => array(
          'db_adapter' => null,
          'logger_table' => 'application_log',
          'priority_filter' => Logger::DEBUG,
          'log_file' => '/tmp/application.log'
      )
  );
  • db_adapter is the database adapter to use (i.e. Zend\Db\Adapter\Adapter or such) if logging to a database
  • logger_table is the table we are writing log entries to (schema is in sql/create.sql)
  • priority_filter the priority to filter against when writing log entries
  • log_file the file on the local file system to log events to

Usage

To use the logger, you can trigger a 'log' event, for example as shown below from a class which implements the ServiceLocatorAwareInterface:, (*3)

  $eventManager = $this->getServiceLocator()->get('Application')->getEventManager();
  $eventManager->trigger('log', $this, array('message' => "Testing Logging", 'priority' => Logger::ERR));

Alternatively, the Logger module comes with a Logger\LoggerTrait trait which can be used (provides a logEvent(<message>, <priority>) method which can be used in any class that provides the ServiceLocatorAwareInterface., (*4)

The Versions

31/01 2014

1.0.x-dev

1.0.9999999.9999999-dev http://www.github.com/coogle/Logger

An Event-driven Logging module for Zend Framework 2

  Sources   Download

BSD-3-Clause

The Requires

 

31/01 2014

dev-master

9999999-dev http://www.github.com/coogle/Logger

An Event-driven Logging module for Zend Framework 2

  Sources   Download

BSD-3-Clause

The Requires