You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(core): Add logger to core and allow scope to be passed log methods (#17698)
Supercedes #16874
This PR makes two changes
1. It adds `logger` as an export to `@sentry/core`, and then refactors
the `browser`, `cloudflare` and `vercel-edge` packages to just re-export
`@sentry/core`'s logger.
This change makes it easy to use logging in an isomorphic way, and
reduces duplication between our various packages. We couldn't change the
export from `node-core` because it has a different type signature than
the standard logger.
2. It expands the logger exports to accept an optional scope argument.
This allows for users to provide their own custom clients to the
methods, which helps with standalone client cases.
```js
import * as Sentry from "@sentry/browser";
const client = createMySentryClient();
const scope = new Sentry.Scope();
scope.setClient(client);
Sentry.logger.info("Hello World!", {}, { scope });
```
0 commit comments