All Projects → slashtrace → Slashtrace

slashtrace / Slashtrace

Licence: mit
Awesome error handler. Demo: https://slashtrace.com/demo.php

Projects that are alternatives of or similar to Slashtrace

Raven Weapp
Sentry SDK for WeApp
Stars: ✭ 142 (-21.98%)
Mutual labels:  error-handling, sentry
sentry-testkit
A Sentry plugin to allow Sentry report interception and further inspection of the data being sent
Stars: ✭ 78 (-57.14%)
Mutual labels:  sentry, error-handling
Sentry Miniapp
Sentry 小程序/小游戏 SDK:用于小程序/小游戏平台的 Sentry SDK(目前支持微信、字节跳动、支付宝、钉钉、QQ、百度小程序,微信、QQ 小游戏)
Stars: ✭ 269 (+47.8%)
Mutual labels:  error-handling, sentry
Graphql Middleware Sentry
🗃 A GraphQL Middleware plugin for Sentry.
Stars: ✭ 141 (-22.53%)
Mutual labels:  sentry
Hwamei
企业微信webhook,企业微信群机器人webhook,支持Github、Gitlab、Sentry等Webhook
Stars: ✭ 142 (-21.98%)
Mutual labels:  sentry
Django Guid
Inject an ID into every log message from a Django request. ASGI compatible, integrates with Sentry, and works with Celery
Stars: ✭ 166 (-8.79%)
Mutual labels:  sentry
Swift Error Handler
Error handling library for Swift
Stars: ✭ 172 (-5.49%)
Mutual labels:  error-handling
Quicklogger
Library for logging on files, console, memory, email, rest, eventlog, syslog, slack, telegram, redis, logstash, elasticsearch, influxdb, graylog, Sentry, Twilio, ide debug messages and throw events for Delphi/Firemonkey/freepascal/.NET (Windows/Linux/OSX/IOS/Android).
Stars: ✭ 137 (-24.73%)
Mutual labels:  sentry
Graphql Errors
Simple error handler for GraphQL Ruby ❗️
Stars: ✭ 170 (-6.59%)
Mutual labels:  error-handling
Bugsnag Go
Automatic panic monitoring for Go and Go web frameworks, like negroni, gin, and revel
Stars: ✭ 155 (-14.84%)
Mutual labels:  error-handling
Cfworker
A collection of packages optimized for Cloudflare Workers and service workers.
Stars: ✭ 152 (-16.48%)
Mutual labels:  sentry
Pyrollbar
Error tracking and logging from Python to Rollbar
Stars: ✭ 169 (-7.14%)
Mutual labels:  error-handling
Redux Catch
Error catcher middleware for Redux reducers and sync middlewares
Stars: ✭ 150 (-17.58%)
Mutual labels:  sentry
Bugsnag Cocoa
Bugsnag crash reporting for iOS, macOS and tvOS apps
Stars: ✭ 167 (-8.24%)
Mutual labels:  error-handling
Bricks
A standard library for microservices.
Stars: ✭ 142 (-21.98%)
Mutual labels:  sentry
Exceptionless
Exceptionless server and jobs
Stars: ✭ 2,107 (+1057.69%)
Mutual labels:  error-handling
Raven Python
Raven is the legacy Python client for Sentry (getsentry.com) — replaced by sentry-python
Stars: ✭ 1,677 (+821.43%)
Mutual labels:  sentry
Serverless Sentry Plugin
This plugin adds automatic forwarding of errors and exceptions to Sentry (https://sentry.io) and Serverless (https://serverless.com)
Stars: ✭ 146 (-19.78%)
Mutual labels:  sentry
Underlinetextfield
Simple UITextfield Subclass with state
Stars: ✭ 156 (-14.29%)
Mutual labels:  error-handling
Wp Sentry
A (unofficial) WordPress plugin reporting PHP and JavaScript errors to Sentry.
Stars: ✭ 174 (-4.4%)
Mutual labels:  sentry

SlashTrace - Awesome error handler

Build Status Code Coverage


Screenshot


SlashTrace is, at its core, an error and exception handler. You hook it into your error handling routine (or let it set itself up to catch all errors and exceptions), and it captures and displays a lot of nice information about your errors. It does this for normal browser requests, but also for AJAX, the CLI, and JSON APIs.

When you're done with local debugging, you can configure SlashTrace to send errors to dedicated error reporting services, like Sentry, Raygun, and Bugsnag.

Usage

  1. Install using Composer:

    composer require slashtrace/slashtrace
    
  2. Capture errors:

    use SlashTrace\SlashTrace;
    use SlashTrace\EventHandler\DebugHandler;
    
    $slashtrace = new SlashTrace();
    $slashtrace->addHandler(new DebugHandler());
    
    // Register the error and exception handlers
    $slashtrace->register();
    

    Alternatively, you can explicitly handle exceptions:

    try {
        // Your code
    } catch (Exception $exception) {
        $slashtrace->handleException($exception);
    }
    

Handlers

SlashTrace comes bundled with the DebugHandler used in the example above, but you will usually want to set it up to send errors to an error tracking service when running in production. Currently, there are handlers implemented for the following providers, and more are on the way. Click each link to view the usage documentation:

Capturing additional data

Besides the complex error information that SlashTrace captures out of the box, you can attach other types of data to each report. This is especially useful when using one of the external handlers above.

This way, SlashTrace acts like an abstraction layer between you and these providers, and normalizes the data that you provide into a single format. This helps you to avoid vendor lock-in and lets you switch error reporting providers simply by switching the handler.

Capturing user data

If you want to attach information about the affected user, you can do so like this:

use SlashTrace\Context\User;

$user = new User();
$user->setId(12345); 
$user->setEmail('[email protected]');
$user->setName('Philip J. Fry');

$slashtrace->addUser($user);

Note that a user needs at least an ID or an email. The name is completely optional.

This feature corresponds to the respective implementations in each error tracker:

Recording breadcrumbs

Sometimes a stack trace isn't enough to figure out what steps lead to an error. To this end, SlashTrace lets you record breadcrumbs during execution:

$slashtrace->recordBreadcrumb("Router loaded");
$slashtrace->recordBreadcrumb("Matched route", [
    "controller" => "orders",
    "action" => "confirm",
]);

Relevant tracker docs:

Tracking releases

Often, it's useful to know which release introduced a particular bug, or which release triggered a regression. Tagging events with a particular release or version number is very easy:

$slashtrace->setRelease("1.0.0"); // <- Your version number, commit hash, etc.

Tracker docs:

Debug renderers

When you use the bundled debug handler, it tries to choose an appropiate output renderer based on the environment in which it's running, like this:

Alternatively, you can force the debug handler to use a particular renderer:

use SlashTrace\EventHandler\DebugHandler;
use SlashTrace\DebugRenderer\DebugJsonRenderer;

$handler = new DebugHandler();
$handler->setRenderer(new DebugJsonRenderer());

$slashtrace->addHandler($handler);
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].