earlhickey/pg-logger

ZF2 logging module

0.2.1 2015-06-19 14:23 UTC

This package is not auto-updated.

Last update: 2024-03-16 14:19:58 UTC


README

ZF2 Logging Module

Log to DB, Email, File, Syslog, FirePHP. Fully customizable with config file.

Call logger directly or with triggers.

Installation

Main Setup

By cloning project

  1. Install the PgLogger ZF2 module by cloning it into ./vendor/.
  2. Clone this project into your ./vendor/ directory.

With composer

  1. Add this project in your composer.json:

    "require": {
        "earlhickey/pg-logger": "0.*"
    }
  2. Now tell composer to download PgLogger by running the command:

    $ php composer.phar update

Post installation

  1. Enabling it in your application.config.php file.

    <?php
    return array(
        'modules' => array(
            // ...
            'PgLogger',
        ),
        // ...
    );
  2. Copy ./vendor/earlhickey/PgLogger/config/pg-logger.global.php.dist to ./config/autoload/pg-logger.global.php and change the values as desired.

  3. Create directory data/log in the root of your ZF2 project.

Usage

  1. Call the logger service directly:
    $this->getServiceLocator()->get('PgLogger\Service\Logger')->crit('test');
  2. Use triggers:
    $this->getEventManager()->trigger('log', $this, array('message' => $message, 'priority' => Logger::CRIT));
    • message
    • priority is optional (default: INFO)