jenssegers/rollbar 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

jenssegers/rollbar

最新稳定版本:v1.5.1

Composer 安装命令:

composer require jenssegers/rollbar

包简介

Rollbar error monitoring integration for Laravel projects

README 文档

README

Build Status Coverage Status

Rollbar error monitoring integration for Laravel projects. This library adds a listener to Laravel's logging component. Laravel's session information will be sent in to Rollbar, as well as some other helpful information such as 'environment', 'server', and 'session'.

rollbar

Installation

Install using composer:

composer require jenssegers/rollbar

Add the service provider to the 'providers' array in config/app.php:

Jenssegers\Rollbar\RollbarServiceProvider::class,

If you only want to enable Rollbar reporting for certain environments you can conditionally load the service provider in your AppServiceProvider:

    public function register()
    {
        if ($this->app->environment('production')) {
            $this->app->register(\Jenssegers\Rollbar\RollbarServiceProvider::class);
        }
    }

Configuration

This package supports configuration through the services configuration file located in config/services.php. All configuration variables will be directly passed to Rollbar:

'rollbar' => [
    'access_token' => env('ROLLBAR_TOKEN'),
    'level' => env('ROLLBAR_LEVEL'),
],

The level variable defines the minimum log level at which log messages are sent to Rollbar. For development you could set this either to debug to send all log messages, or to none to sent no messages at all. For production you could set this to error so that all info and debug messages are ignored.

Usage

To automatically monitor exceptions, simply use the Log facade in your error handler in app/Exceptions/Handler.php:

public function report(Exception $exception)
{
    \Log::error($exception); //rollbar
    parent::report($exception);
}

For Laravel 4 installations, this is located in app/start/global.php:

App::error(function(Exception $exception, $code)
{
    Log::error($exception);
});

Your other log messages will also be sent to Rollbar:

\Log::debug('Here is some debug information');

NOTE: Fatal exceptions will always be sent to Rollbar.

Context informaton

You can pass user information as context like this:

\Log::error('Something went wrong', [
    'person' => ['id' => 123, 'username' => 'John Doe', 'email' => 'john@doe.com']
]);

Or pass some extra information:

\Log::warning('Something went wrong', [
    'download_size' => 3432425235
]);

统计信息

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

GitHub 信息

  • Stars: 324
  • Watchers: 11
  • Forks: 98
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-04-27