mez/zend-expressive-sentry

此包已被废弃,不再维护。作者建议使用 mez/mezzio-sentry 包。

Zend Expressive 错误日志记录的 Sentry

1.0 2019-01-26 14:27 UTC

This package is auto-updated.

Last update: 2020-01-23 17:29:37 UTC


README

All Contributors

这是一个为 Zend Expressive 添加快速扩展,使其能够将错误报告给 Sentry 的工具。

配置说明

将类 \Mez\Sentry\ConfigProvider 添加到您的配置聚合中

例如:

<?php

use Zend\ConfigAggregator\ArrayProvider;
use Zend\ConfigAggregator\ConfigAggregator;
use Zend\ConfigAggregator\PhpFileProvider;

$cacheConfig = [
    'config_cache_path' => 'data/config-cache.php',
];

$aggregator = new ConfigAggregator(
    [
        \Mez\Sentry\ConfigProvider::class,

        // Include cache configuration
        new ArrayProvider($cacheConfig),

        // Default App module config
        \App\ConfigProvider::class,

        // Load application config in a pre-defined order in such a way that local settings
        // overwrite global settings. (Loaded as first to last):
        //   - `global.php`
        //   - `*.global.php`
        //   - `local.php`
        //   - `*.local.php`
        new PhpFileProvider('config/autoload/{{,*.}global,{,*.}local}.php'),

        // Load development config if it exists
        new PhpFileProvider('config/development.config.php'),
    ], $cacheConfig['config_cache_path']
);

return $aggregator->getMergedConfig();

这将自动将 Sentry 添加为错误监听器。

您可以通过在配置文件中定义来配置 DSN -我们建议将 config/sentry.global.php.dist 复制到您的应用 config/autoload 目录中,并将其重命名为 sentry.global.php - 添加您的 DSN(或设置环境变量)并完成配置!

贡献者

感谢这些优秀的人们(emoji key

此项目遵循 all-contributors 规范。欢迎任何形式的贡献!