Coder Social home page Coder Social logo

chtombleson / silverstripe-sentry Goto Github PK

View Code? Open in Web Editor NEW

This project forked from phptek/silverstripe-sentry

0.0 0.0 0.0 227 KB

Flexible Sentry bug aggregation client for SilverStripe applications.

License: BSD 3-Clause "New" or "Revised" License

PHP 100.00%

silverstripe-sentry's Introduction

Sentry.io integration for SilverStripe

Build Status Scrutinizer Code Quality License

Sentry is an error and exception aggregation service. It takes your application's errors, aggregates them alongside configurable context and stores them for later analysis and debugging.

Imagine this: You see errors and exceptions before your clients do. The error > report > debug > patch > deploy cycle is therefore the most efficient it can possibly be.

This module binds Sentry.io and hosted Sentry installations, to the Monlog error logger in SilverStripe. If you've used systems like RayGun, Rollbar, AirBrake and BugSnag before, you'll know roughly what to expect.

Requirements

See composer.json.

Setup:

composer require phptek/sentry

Notes:

  • Version 5.x is aimed at Silverstripe 5.
  • Versions 2.x, 3.x and 4.x should work with the same Silverstripe v4 setups. v3+ simply use newer versions of the Sentry PHP SDK and have additional bugfixes and features.
  • Version 3.x SentryClientAdaptor has been renamed to SentryAdaptor and SentryLogWriter was renamed to SentryLogger, so your existing configuration(s) may need to be updated accordingly.

Config

You can set your DSN as a first-class environment variable or via your project's .env file:

SENTRY_DSN="http://deacdf9dfedb24ccdce1b90017b39dca:[email protected]/44"

Or you can set it in YML config, where you gain a little more flexibility and control:

The following will get you errors reported in all environment modes: dev, test and live:

---
Name: my-project-config-sentry
After:
  - 'sentry-config'
---

PhpTek\Sentry\Adaptor\SentryAdaptor:
  opts:
    # Example DSN only. Obviously you'll need to setup your own Sentry "Project"
    dsn: http://deacdf9dfedb24ccdce1b90017b39dca:[email protected]/44

Conditional Config

The following will get you errors reported just in test and live but not dev:

---
Name: my-project-config-sentry
After:
  - 'sentry-config'
---

---
Only:
  environment: test
---
PhpTek\Sentry\Adaptor\SentryAdaptor:
  opts:
    # Example DSN only. Obviously you'll need to setup your own Sentry "Project"
    dsn: http://deacdf9dfedb24ccdce1b90017b39dca:[email protected]/44
---
Except:
  environment: test
---
PhpTek\Sentry\Adaptor\SentryAdaptor:
  opts:
    # Example DSN only. Obviously you'll need to setup your own Sentry "Project"
    dsn: http://deacdf9dfedb24ccdce1b90017b39dca:[email protected]/44
---
Only:
  environment: dev
---
PhpTek\Sentry\Adaptor\SentryAdaptor:
  opts:
    dsn: null
---

Please review the usage docs for further configuration and customisation options.

Notes:

  • You can silence errors from Injector where "test" and "live" envs have http_proxy set, but "dev" environments don't. Just set null as the value. This applies to all YML config where some envs have a setting and others don't. For example:
...
    ---
    Only:
      environment: dev
    ---
    PhpTek\Sentry\Adaptor\SentryAdaptor:
      opts:
        dsn: null
        http_proxy: null
    ---
...
  • As per the examples above, ensure your project's Sentry config is set to come after the module's own config, thus:

    After: - 'sentry-config'

SilverStripe Framework v3

YML Config:

phptek\Sentry\Adaptor\SentryClientAdaptor:
  opts:
    # Example DSN only. Obviously you'll need to setup your own Sentry "Project"
    dsn: http://deacdf9dfedb24ccdce1b90017b39dca:[email protected]/44

mysite/_config.php:

SS_Log::add_writer(\phptek\Sentry\SentryLogWriter::factory(), SS_Log::ERR, '<=');

Usage

Sentry is normally setup once in your project's YML config or _config.php file. See the above examples and the usage docs for details and options.

Support Me

If you like what you see, support me! I accept Bitcoin:

Bitcoin
3KxmqFeVWoigjvXZoLGnoNzvEwnDq3dZ8Q

 

 

silverstripe-sentry's People

Contributors

phptek avatar dcentrica avatar lekoala avatar tractorcow avatar halles avatar elliot-sawyer avatar g-rath avatar hjgreen avatar jcop007 avatar jonom avatar zpetterd avatar scott1702 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.