Skip to content

Commit

Permalink
add hubProvider details to readme in logrus (#952)
Browse files Browse the repository at this point in the history
  • Loading branch information
ribice authored Jan 26, 2025
1 parent f2d4348 commit 9e8583d
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion logrus/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,22 @@ sentryHook.AddTags(map[string]string{
"key": "value",
})
```
-

- Using `hubProvider` for Scoped Sentry Hubs

The hubProvider allows you to configure the Sentry hook to use a custom Sentry hub. This can be particularly useful when you want to scope logs to specific goroutines or operations, enabling more precise grouping and context in Sentry.

You can set a custom hubProvider function using the SetHubProvider method:

```go
sentryHook.SetHubProvider(func() *sentry.Hub {
// Create or return a specific Sentry hub
return sentry.NewHub(sentry.GetCurrentHub().Client(), sentry.NewScope())
})
```

This ensures that logs from specific contexts or threads use the appropriate Sentry hub and scope.


## Notes

Expand Down

0 comments on commit 9e8583d

Please sign in to comment.