https://github.com/geo6/mezzio-monolog
Zend Expressive Monolog ErrorHandler
https://github.com/geo6/mezzio-monolog
error-handler laminas mezzio monolog php sentry sentry-php zend-expressive
Last synced: 7 months ago
JSON representation
Zend Expressive Monolog ErrorHandler
- Host: GitHub
- URL: https://github.com/geo6/mezzio-monolog
- Owner: geo6
- License: gpl-3.0
- Created: 2019-08-19T17:16:50.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-07-22T13:59:14.000Z (about 2 years ago)
- Last Synced: 2025-03-13T06:36:48.190Z (7 months ago)
- Topics: error-handler, laminas, mezzio, monolog, php, sentry, sentry-php, zend-expressive
- Language: PHP
- Homepage:
- Size: 64.5 KB
- Stars: 3
- Watchers: 0
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Mezzio Monolog ErrorHandler
[](https://packagist.org/packages/geo6/mezzio-monolog)
[](https://packagist.org/packages/geo6/mezzio-monolog)
[](https://packagist.org/packages/geo6/mezzio-monolog)
[](LICENSE)This library enables [Monolog](https://github.com/Seldaek/monolog) as ErrorHandler in Mezzio.
Currently, there are 2 handlers supported (more will be added if needed):
- [`StreamHandler`](https://github.com/Seldaek/monolog/blob/master/src/Monolog/Handler/StreamHandler.php): Logs records into any PHP stream, use this for log files.
- [`SentryHandler`](https://github.com/geo6/mezzio-monolog/blob/master/src/Handler/SentryHandler.php): Logs records to [Sentry.io](https://sentry.io/) (requires `sentry/sdk` package).## Install
```cmd
composer require geo6/mezzio-monolog
```## Configuration
Create a `monolog.global.php` file in your `config` directory:
```php
[
'path' => 'data/log/myapp.log',
],
// SentryHanlder
'sentry' => [
'dsn' => 'https://xxxxx@sentry.io/12345',
],
];
```## Usage
To enable it, you just have to add `Geo6\Mezzio\Monolog\ConfigProvider::class` to your main configuration (usually `config/config.php`):
```diff
...$aggregator = new ConfigAggregator([
+ Geo6\Mezzio\Monolog\ConfigProvider::class,...
], $cacheConfig['config_cache_path']);...
```The Monolog ErrorHandler will be active only in "production mode" (when `$config['debug]` is `false`).
To switch to "production mode", you can use `composer run development-disable`.