项目作者: geo6

项目描述 :
Zend Expressive Monolog ErrorHandler
高级语言: PHP
项目地址: git://github.com/geo6/mezzio-monolog.git
创建时间: 2019-08-19T17:16:50Z
项目社区:https://github.com/geo6/mezzio-monolog

开源协议:GNU General Public License v3.0

下载


Mezzio Monolog ErrorHandler

Latest Stable Version
Total Downloads
Monthly Downloads
Software License

This library enables Monolog as ErrorHandler in Mezzio.

Currently, there are 2 handlers supported (more will be added if needed):

Install

  1. composer require geo6/mezzio-monolog

Configuration

Create a monolog.global.php file in your config directory:

  1. <?php
  2. declare(strict_types=1);
  3. return [
  4. // StreamHandler
  5. 'stream' => [
  6. 'path' => 'data/log/myapp.log',
  7. ],
  8. // SentryHanlder
  9. 'sentry' => [
  10. 'dsn' => 'https://xxxxx@sentry.io/12345',
  11. ],
  12. ];

Usage

To enable it, you just have to add Geo6\Mezzio\Monolog\ConfigProvider::class to your main configuration (usually config/config.php):

  1. ...
  2. $aggregator = new ConfigAggregator([
  3. + Geo6\Mezzio\Monolog\ConfigProvider::class,
  4. ...
  5. ], $cacheConfig['config_cache_path']);
  6. ...

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.