承接 bugsnag/bugsnag-psr-logger 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

bugsnag/bugsnag-psr-logger

最新稳定版本:v2.0.0

Composer 安装命令:

composer require bugsnag/bugsnag-psr-logger

包简介

Official Bugsnag PHP PSR Logger.

README 文档

README

StyleCI Status

The Bugsnag PHP PSR logger is an implementation of the Fig PSR logging standard that provides a standard interface to logging to Bugsnag.

Getting Started

Installing

Add bugsnag/bugsnag-psr-logger to your composer.json.

Configuring

This library provides a logger interface but uses the bugsnag-php notifier library as a base. All configuration should be performed as described in the official bugsnag-php documentation.

Using the Loggers

The library provides two loggers, BugsnagLogger and MultiLogger.

BugsnagLogger will automatically send a notification to Bugsnag if it receives a message with a severity higher than info. This will allow you to notify of any handled exceptions through interfacing the logger directly with the framework you are using. Ensure that the logger can communicate with the bugsnag-php library by passing the client object into it on creation.

$bugsnag = Bugsnag\Client::make('YOUR-API-KEY-HERE');
$logger = new Bugsnag\PsrLogger\BugsnagLogger($bugsnag);

# Will send a notification to bugsnag
$logger->error('An error occurred');

If you wish to use a separate logger alongside BugsnagLogger you will need to use MultiLogger. By passing it an array of Logger objects on construction, MultiLogger will call into each passed Logger in turn when a message is logged.

$logger = new Bugsnag\PsrLogger\BugsnagLogger($bugsnag);
$mySecondLogger = new Logger();
$multiLogger = new Bugsnag\PsrLogger\MultiLogger([$logger, $mySecondLogger]);

# Will log to $mySecondLogger and send a notification to bugsnag through $logger
$multiLogger->error('An error occurred');

The default level at which logs will be sent to Bugsnag is Psr\Log\LogLevel::NOTICE. This can be overridden using the setNotifyLevel function:

$logger = new Bugsnag\PsrLogger\BugsnagLogger($bugsnag);

# Will not send a notification to bugsnag by default
$logger->info('Some interesting information');

$logger->setNotifyLevel(Psr\Log\LogLevel::INFO);

# Will send a notification to bugsnag
$logger->info('Some more interesting information');

For more information on integrating the loggers into specific frameworks see the individual setup information found in the bugsnag-php documentation.

Contributing

All contributors are welcome! For information on how to build, test and release bugsnag-psr-logger, see our contributing guide. Feel free to comment on existing issues for clarification or starting points.

License

The Bugsnag PSR logger is free software released under the MIT License. See LICENSE.txt for details.

统计信息

  • 总下载量: 30.78M
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 321
  • 点击次数: 1
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 321
  • Watchers: 31
  • Forks: 6
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固