Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/piotr-cz/monolog-piwik-handler
Piwik Handler for Monolog
https://github.com/piotr-cz/monolog-piwik-handler
monolog-handler php piwik
Last synced: 27 days ago
JSON representation
Piwik Handler for Monolog
- Host: GitHub
- URL: https://github.com/piotr-cz/monolog-piwik-handler
- Owner: piotr-cz
- License: mit
- Created: 2015-10-23T07:56:39.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-01-31T09:41:53.000Z (almost 8 years ago)
- Last Synced: 2024-04-26T10:03:14.387Z (7 months ago)
- Topics: monolog-handler, php, piwik
- Language: PHP
- Size: 2.93 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Piwik Handler for Monolog
Provides a handler for [Monolog](https://github.com/Seldaek/monolog) that sends records to piwik server.
## Installation
This library can be installed via composer: "piotr-cz/monolog-piwik-handler": "~1.0"
```sh
$ composer require piotr-cz/monolog-piwik-handler
```## Example use
Example setup using [Pimple](http://pimple.sensiolabs.org/) DI Container
```php
// 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
```php
$logger->addError('500', ['exception' => $exception]);
```## Requirements
* PHP 5.3+
## License
Released under the [MIT License](./LICENSE.md)