rcrowe / Raven

Send to Sentry in the background
34 stars 13 forks source link

Adding extra information from Laravel provider #2

Closed srtfisher closed 10 years ago

srtfisher commented 10 years ago

I think it would a great addition to have the ability to add extra information to pass to Sentry from the Laravel provider. I would love to pass in user info, server name, environment etc.

Unless this is currently possible... Seems to be possible with the Raven PHP client.

rcrowe commented 10 years ago

This should already be possible, the client extends the default Raven client.

When time permits I want to add in better support for collecting automatically from Laravel.

On 4 Dec 2013, at 17:43, Sean Fisher notifications@github.com wrote:

I think it would a great addition to have the ability to add extra information to pass to Sentry from the Laravel provider. I would love to pass in user info, server name, environment etc.

Unless this is currently possible... Seems to be possible with the Raven PHP client.

— Reply to this email directly or view it on GitHub.

srtfisher commented 10 years ago

Thank you for building this, too. Made my life easier to add Sentry support to Laravel.

srtfisher commented 10 years ago

Would also be great to have the Log Level feature that you had for your laravel-sentry package put back into it.

rcrowe commented 10 years ago

Yeah working on that one. Someone raised that the other day.

Happy to accept pull requests :)

On 4 Dec 2013, at 18:04, Sean Fisher notifications@github.com wrote:

Would also be great to have the Log Level feature that you had for your laravel-sentry package put back into it.

— Reply to this email directly or view it on GitHub.

ux-engineer commented 10 years ago

@rcrowe Better be working on that one! :D :+1: Practically I cannot use this package nor Sentry (unless installing the old package) as Sentry will soon be full of info level loggings as errors!

ux-engineer commented 10 years ago

:+1: For automatic details!

rcrowe commented 10 years ago

I'll have this all fixed in the feature/0.2.0 branch which should be out shortly.

rcrowe commented 10 years ago

So log levels are now support.

There are 3 new helper functions:

If you need to set any custom extra context/tags etc you have access to the Raven client, like so:

App::make('log.sentry')->extra_context(...);

You can also pass extra context through the log methods which will be passed on to Sentry:

Log::error('message goes here', [
    'foo' => 'bar'
]);

Overall, there is much better integration with Sentry now. Let me know if I can add anything else. Few more tests to write, then I'll merge and tag 0.2.0.

rcrowe commented 10 years ago

Think I'm going to remove Log::exception() as there's complexities around (log level) that just aren't needed.

Instead I'll patch the log methods to react to receiving an Exception object passed in.

rcrowe commented 10 years ago

Removed Log::exception, now just use Log::error($exception, $context = array())

jbrooksuk commented 10 years ago

With Log::setUser, is this something I can call in start.php with Log::setUser(Auth::user())?