mead-steve / mono-snag
monolog 的 Bugsnag 集成。一个抽象处理程序,将消息发送到 Bugsnag
v4.1.0
2021-03-18 11:40 UTC
Requires
- php: ^7.2 || ^8.0
- bugsnag/bugsnag: ^3.4
- monolog/monolog: ^2.0
Requires (Dev)
- phpunit/phpunit: ^8.5.8 || ^9.4.2
- squizlabs/php_codesniffer: ^3.5
README
安装
通过 Composer 使用
composer require mead-steve/mono-snag
用法
提供了一个包装 Bugsnag 客户端的处理程序。默认情况下,处理程序将捕获 Logger::ERROR 级别及以上的所有内容并发送到 Bugsnag。
$logger = new Monolog\Logger("Example"); $bugsnagClient = new Bugsnag\Client('YOUR-BUGSNAG-API-KEY-HERE'); //... bugsnag specific config goes here. $bugsnagHandler = new \MeadSteve\MonoSnag\BugsnagHandler($bugsnagClient); $logger->pushHandler($bugsnagHandler); // The following error will get sent automatically to Bugsnag $logger->addError("oh no!", array('exception' => new \Exception("ohnoception")));