Skip to content

Commit d833da7

Browse files
committed
Use astro logger instead of console (#9995)
We can simply use `AstroIntegrationLogger` instead of console. This might improve DX. https://docs.astro.build/en/reference/integrations-reference/#astrointegrationlogger
1 parent 2aae69c commit d833da7

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

packages/astro/src/integration/index.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import * as fs from 'fs';
22
import * as path from 'path';
3-
/* eslint-disable no-console */
43
import { sentryVitePlugin } from '@sentry/vite-plugin';
54
import type { AstroConfig, AstroIntegration } from 'astro';
65

@@ -14,7 +13,7 @@ export const sentryAstro = (options: SentryOptions = {}): AstroIntegration => {
1413
name: PKG_NAME,
1514
hooks: {
1615
// eslint-disable-next-line complexity
17-
'astro:config:setup': async ({ updateConfig, injectScript, addMiddleware, config, command }) => {
16+
'astro:config:setup': async ({ updateConfig, injectScript, addMiddleware, config, command, logger }) => {
1817
// The third param here enables loading of all env vars, regardless of prefix
1918
// see: https://main.vitejs.dev/config/#using-environment-variables-in-config
2019

@@ -62,10 +61,10 @@ export const sentryAstro = (options: SentryOptions = {}): AstroIntegration => {
6261
: findDefaultSdkInitFile('client');
6362

6463
if (pathToClientInit) {
65-
options.debug && console.log(`[sentry-astro] Using ${pathToClientInit} for client init.`);
64+
options.debug && logger.info(`Using ${pathToClientInit} for client init.`);
6665
injectScript('page', buildSdkInitFileImportSnippet(pathToClientInit));
6766
} else {
68-
options.debug && console.log('[sentry-astro] Using default client init.');
67+
options.debug && logger.info('Using default client init.');
6968
injectScript('page', buildClientSnippet(options || {}));
7069
}
7170
}
@@ -75,10 +74,10 @@ export const sentryAstro = (options: SentryOptions = {}): AstroIntegration => {
7574
? path.resolve(options.serverInitPath)
7675
: findDefaultSdkInitFile('server');
7776
if (pathToServerInit) {
78-
options.debug && console.log(`[sentry-astro] Using ${pathToServerInit} for server init.`);
77+
options.debug && logger.info(`Using ${pathToServerInit} for server init.`);
7978
injectScript('page-ssr', buildSdkInitFileImportSnippet(pathToServerInit));
8079
} else {
81-
options.debug && console.log('[sentry-astro] Using default server init.');
80+
options.debug && logger.info('Using default server init.');
8281
injectScript('page-ssr', buildServerSnippet(options || {}));
8382
}
8483
}

0 commit comments

Comments
 (0)