amberovsky / zf2-monolog
Monolog integration to Zend Framework 2
Installs: 1 445
Dependents: 0
Suggesters: 0
Security: 0
Stars: 5
Watchers: 2
Forks: 1
Open Issues: 0
Requires
- php: >=5.5
- monolog/monolog: ~1.13
- zendframework/zend-loader: ~2.0
- zendframework/zend-modulemanager: ~2.0
- zendframework/zend-mvc: ~2.0
- zendframework/zend-servicemanager: ~2.0
Requires (Dev)
- phpunit/phpunit: ~4.6
This package is auto-updated.
Last update: 2025-03-06 00:40:29 UTC
README
Install
{ "require": { "amberovsky/zf2-monolog": "~0" } }
Usage
- Add
Monolog
to yourconfig/application.config.php
. - Configure loggers (
config/logs.php
):
use Amberovsky\Monolog\Config; use Monolog\Handler\StreamHandler; use Formatter; return [ 'monolog' => [ 'root' => [ Config::SECTION_HANDLERS => [ [ Config::HANDLER_CLASS => StreamHandler::class, Config::HANDLER_ARGS => [ 'path' => '/var/log/root.log', ], config::HANDLER_FORMATTER => [ Config::FORMATTER_CLASS => Formatter::class, Config::FORMATTER_ARGS => [ ] ], ], ], ] ] ];
- Write to log:
use Amberovsky\Monolog\MonologFactoryTrait; class Whatever { use MonologFactoryTrait; public function action() { $this->getMonologFactory()->getLogger('root')->debug('hello'); } }