Download the PHP package eddiejaoude/zf2-logger without Composer
On this page you can find all versions of the php package eddiejaoude/zf2-logger. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download eddiejaoude/zf2-logger
More information about eddiejaoude/zf2-logger
Files in eddiejaoude/zf2-logger
Package zf2-logger
Short Description Zend Framework 2 Logger - request & response log
License MIT
Informations about the package zf2-logger
EddieJaoude\Zf2Logger
Zend Framework 2 Event Logger.
- Log incoming Requests & Response data with host name
- Manually log your application information with priorities (i.e. emerg..debug)
- Change your logging output via config without changing code
- Multiple logging outputs (i.e. file(s), stdout, stderr etc)
- Filter errors to log per environment (i.e production > error, development > debug)
- Default log information includes (Session Id, Host, IP)
Installation via Composer
Steps
1. Add to composer.
Update your dependencies php composer.phar update eddiejaoude/zf2-logger
2. Copy the configuration file config/module.config.php.dist
to config/autoload/zf2Logger.global.php
3. Add module to application config (/config/application.config.php)
Then you are good to go. Logging READY! All requests & responses will be logged automatically as
Example usage of manual logging & prority
As the is returned from the Service call, one can use the methods:
- emerg // Emergency: system is unusable
- alert // Alert: action must be taken immediately
- crit // Critical: critical conditions
- err // Error: error conditions
- warn // Warning: warning conditions
- notice // Notice: normal but significant condition
- info // Informational: informational messages
- debug // Debug: debug messages
Use an alias for decoupling
Instead of using EddieJaoude\Zf2Logger
in your code, put an Alias
in your service manager, therefore allowing you to swap out different logger libraries later on without modifying your code & usage.
i.e.
Then your usage in your code becomes...
Add to default logging parameters
Additional default logging information includes:
- IP
- Host
- Session Id
To log more additional default information, use $logger->addCustomExtra($extraArray)
. Full example below.
-
Change the
alias
to your new service (point 2 below) i.e. - Create your new service
Example - built in logging
Each output includes & is prepended with the host - this is especially useful when working with multi layer/tier architecture, i.e. F/E (UI) -> B/E (API). As these can all write to the same output in the stack execution order or alternatively to different outputs.
Request (priority DEBUG)
Response (priority DEBUG)
Configuration (config)
Unit tests
To run unit tests (from root diectory)
-
Download Composer
-
Install dependencies
- Run tests
Example output of Log file
What Next...
- Additional events
Ideas & requirements welcome.
Contributing
- Discussions from Ideas & Discussions to Pull Requests
- Pull requests with Unit tests
Resources
- Github https://github.com/eddiejaoude/zf2-logger
- Packagist https://packagist.org/packages/eddiejaoude/zf2-logger
- Zend Framework 2 Modules http://modules.zendframework.com/eddiejaoude/zf2-logger
- Travis CI https://travis-ci.org/eddiejaoude/zf2-logger
- Coveralls https://coveralls.io/r/eddiejaoude/zf2-logger
- Scrutinizer https://scrutinizer-ci.com/g/eddiejaoude/zf2-logger/
All versions of zf2-logger with dependencies
zendframework/zend-log Version 2.*
zendframework/zend-di Version 2.*
zendframework/zend-eventmanager Version 2.*
zendframework/zend-mvc Version 2.*