piotr-cz / monolog-piwik-handler
Piwik Handler for Monolog
dev-master
2017-01-31 09:41 UTC
Requires
- php: >=5.3.0
- monolog/monolog: ~1.0
- piwik/piwik-php-tracker: ~1.0
This package is not auto-updated.
Last update: 2024-12-19 01:12:31 UTC
README
Provides a handler for Monolog that sends records to piwik server.
Installation
This library can be installed via composer: "piotr-cz/monolog-piwik-handler": "~1.0"
$ composer require piotr-cz/monolog-piwik-handler
Example use
Example setup using Pimple DI Container
// Add PiwikTracker to DIC $container['PiwikTracker'] = function($c) { return new \PiwikTracker( // idSite 1, // apiUrl 'http://piwik.domain.tld/' ); } // Add Logger to DIC $container['logger'] = function($c) { $logger = new \Monolog\Logger('app']); $logger->pushHandler( new \PiotrCz\MonologPiwikHandler\PiwikHandler( // Piwik tracker instance $c['PiwikTracker'], // Optional category to log errors to. 'Errors' ) ); }
Then in your error handler
$logger->addError('500', ['exception' => $exception]);
Requirements
- PHP 5.3+
License
Released under the MIT License