library pg-logger
ZF2 logging module
earlhickey/pg-logger
ZF2 logging module
- Friday, June 19, 2015
- by earlhickey
- Repository
- 1 Watchers
- 0 Stars
- 239 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 4 Versions
- 13 % Grown
PgLogger
ZF2 Logging Module, (*1)
Log to DB, Email, File, Syslog, FirePHP. Fully customizable with config file., (*2)
Call logger directly or with triggers., (*3)
Installation
Main Setup
By cloning project
- Install the PgLogger ZF2 module
by cloning it into
./vendor/.
- Clone this project into your
./vendor/ directory.
With composer
-
Add this project in your composer.json:, (*4)
"require": {
"earlhickey/pg-logger": "0.*"
}
-
Now tell composer to download PgLogger by running the command:, (*5)
$ php composer.phar update
Post installation
-
Enabling it in your application.config.php file., (*6)
<?php
return array(
'modules' => array(
// ...
'PgLogger',
),
// ...
);
-
Copy ./vendor/earlhickey/PgLogger/config/pg-logger.global.php.dist to ./config/autoload/pg-logger.global.php and change the values as desired., (*7)
-
Create directory data/log in the root of your ZF2 project., (*8)
Usage
- Call the logger service directly:
php
$this->getServiceLocator()->get('PgLogger\Service\Logger')->crit('test');
- Use triggers:
php
$this->getEventManager()->trigger('log', $this, array('message' => $message, 'priority' => Logger::CRIT));
- message
- priority is optional (default: INFO)