Giter VIP home page Giter VIP logo

Comments (4)

adnanmayo avatar adnanmayo commented on May 27, 2024 1

@stayallive thanks. Stayalive 👍

from sentry-laravel.

stayallive avatar stayallive commented on May 27, 2024

Hey @adnanmayo,

Please read the readme, it is explained there how to do that: https://github.com/getsentry/sentry-laravel#adding-context

If you have trouble figuring out what to make of $sentry->user_context([...]);, here is a example:

$user = auth()->user();
$sentry->user_context([
    'id' => $user->id,
    'email' => $user->email,
]);

from sentry-laravel.

adnanmayo avatar adnanmayo commented on May 27, 2024

@stayallive thanks for your response.

public function report(Exception $e) { if ($this->shouldReport($e)) { if (app()->bound('sentry')) { $sentry = app('sentry'); if (auth()->check()) { $sentry->user_context([ "user_id" => \Auth::id(), "email" => \Auth::user()->email ]); } else { $sentry->user_context(['id' => null]); } $sentry->tags_context([]); } app('sentry')->captureException($e); } parent::report($e); }

i am trying i this way, if i am wrong can you please guide me how i can achieve this. Can you please also tell what is $sentry->tags_context([...]);

from sentry-laravel.

stayallive avatar stayallive commented on May 27, 2024

@adnanmayo That should also work.

Tags context sets the value of tags, you can for example add the php version as a tag or the route action and so forth. You can read more about the configuration options in the sentry-php docs: https://docs.sentry.io/hosted/clients/php/config/#available-settings

from sentry-laravel.

Related Issues (20)

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.