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
This streamlines astro build logs in two ways:
1. Guard all logs (except the deprecation warning) behind `debug: true`
2. Use the astro logger instead of `console.log` everywhere. This
automatically prepends the message with `@sentry/astro`, so no need for
our own prefix there - see
https://docs.astro.build/en/reference/integrations-reference/#astrointegrationlogger
3. If `sourceMaps: false` is explicitly set by a user, we always show a
short warning, and a longer warning with more context when `debug: true`
`[Sentry] You passed in additional options (${otherOptionsKeys.join(
43
-
', ',
44
-
)}) to the Sentry integration. This is deprecated and will stop working in a future version. Instead, configure the Sentry SDK in your \`sentry.client.config.(js|ts)\` or \`sentry.server.config.(js|ts)\` files.`,
45
-
);
46
-
});
38
+
logger.warn(
39
+
`You passed in additional options (${otherOptionsKeys.join(
40
+
', ',
41
+
)}) to the Sentry integration. This is deprecated and will stop working in a future version. Instead, configure the Sentry SDK in your \`sentry.client.config.(js|ts)\` or \`sentry.server.config.(js|ts)\` files.`,
@@ -234,39 +229,36 @@ export function getUpdatedSourceMapSettings(
234
229
letupdatedSourceMapSetting=viteSourceMap;
235
230
236
231
constsettingKey='vite.build.sourcemap';
232
+
constdebug=sentryOptions?.debug;
237
233
238
234
if(viteSourceMap===false){
239
235
previousUserSourceMapSetting='disabled';
240
236
updatedSourceMapSetting=viteSourceMap;
241
237
242
-
consoleSandbox(()=>{
243
-
// eslint-disable-next-line no-console
244
-
console.warn(
245
-
`[Sentry] Source map generation is currently disabled in your Astro configuration (\`${settingKey}: false\`). This setting is either a default setting or was explicitly set in your configuration. Sentry won't override this setting. Without source maps, code snippets on the Sentry Issues page will remain minified. To show unminified code, enable source maps in \`${settingKey}\` (e.g. by setting them to \`hidden\`).`,
238
+
if(debug){
239
+
// Longer debug message with more details
240
+
logger.warn(
241
+
`Source map generation is currently disabled in your Astro configuration (\`${settingKey}: false\`). This setting is either a default setting or was explicitly set in your configuration. Sentry won't override this setting. Without source maps, code snippets on the Sentry Issues page will remain minified. To show unminified code, enable source maps in \`${settingKey}\` (e.g. by setting them to \`hidden\`).`,
246
242
);
247
-
});
243
+
}else{
244
+
logger.warn('Source map generation is disabled in your Astro configuration.');
`[Sentry] We discovered \`${settingKey}\` is set to \`${viteSourceMap.toString()}\`. Sentry will keep this source map setting. This will un-minify the code snippet on the Sentry Issue page.`,
257
-
);
258
-
});
259
-
}
250
+
debug&&
251
+
logger.info(
252
+
`We discovered \`${settingKey}\` is set to \`${viteSourceMap.toString()}\`. Sentry will keep this source map setting. This will un-minify the code snippet on the Sentry Issue page.`,
253
+
);
260
254
}else{
261
255
previousUserSourceMapSetting='unset';
262
256
updatedSourceMapSetting='hidden';
263
257
264
-
consoleSandbox(()=>{
265
-
// eslint-disable-next-line no-console
266
-
console.log(
267
-
`[Sentry] Enabled source map generation in the build options with \`${settingKey}: 'hidden'\`. The source maps will be deleted after they were uploaded to Sentry.`,
258
+
debug&&
259
+
logger.info(
260
+
`Enabled source map generation in the build options with \`${settingKey}: 'hidden'\`. The source maps will be deleted after they were uploaded to Sentry.`,
'[Sentry] You passed in additional options (environment, release, dsn) to the Sentry integration. This is deprecated and will stop working in a future version. Instead, configure the Sentry SDK in your `sentry.client.config.(js|ts)` or `sentry.server.config.(js|ts)` files.',
325
+
expect(logger.warn).toHaveBeenCalledWith(
326
+
'You passed in additional options (environment, release, dsn) to the Sentry integration. This is deprecated and will stop working in a future version. Instead, configure the Sentry SDK in your `sentry.client.config.(js|ts)` or `sentry.server.config.(js|ts)` files.',
0 commit comments