Commit f3aa997
authored
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 });
```1 parent 162143f commit f3aa997
File tree
17 files changed
+294
-502
lines changed- packages
- browser
- src
- test
- cloudflare/src
- logs
- core
- src
- integrations
- logs
- test/lib
- integrations
- logs
- node-core
- src/logs
- test/logs
- vercel-edge/src
17 files changed
+294
-502
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | 3 | | |
5 | 4 | | |
6 | 5 | | |
7 | | - | |
8 | | - | |
9 | 6 | | |
10 | 7 | | |
11 | 8 | | |
| |||
63 | 60 | | |
64 | 61 | | |
65 | 62 | | |
| 63 | + | |
66 | 64 | | |
67 | 65 | | |
68 | 66 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| 34 | + | |
| 35 | + | |
33 | 36 | | |
34 | 37 | | |
35 | | - | |
36 | | - | |
| 38 | + | |
| 39 | + | |
37 | 40 | | |
38 | 41 | | |
39 | 42 | | |
| |||
58 | 61 | | |
59 | 62 | | |
60 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
61 | 67 | | |
62 | | - | |
63 | | - | |
| 68 | + | |
| 69 | + | |
64 | 70 | | |
65 | 71 | | |
66 | 72 | | |
| |||
73 | 79 | | |
74 | 80 | | |
75 | 81 | | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
76 | 85 | | |
77 | | - | |
78 | | - | |
| 86 | + | |
| 87 | + | |
79 | 88 | | |
80 | 89 | | |
81 | 90 | | |
| |||
84 | 93 | | |
85 | 94 | | |
86 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
87 | 99 | | |
88 | | - | |
| 100 | + | |
89 | 101 | | |
90 | 102 | | |
91 | 103 | | |
| |||
94 | 106 | | |
95 | 107 | | |
96 | 108 | | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
97 | 112 | | |
98 | | - | |
| 113 | + | |
99 | 114 | | |
100 | 115 | | |
101 | 116 | | |
102 | 117 | | |
103 | 118 | | |
104 | | - | |
| 119 | + | |
105 | 120 | | |
106 | 121 | | |
107 | 122 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
| 99 | + | |
99 | 100 | | |
100 | 101 | | |
101 | | - | |
102 | | - | |
103 | 102 | | |
104 | 103 | | |
105 | 104 | | |
| |||
0 commit comments