11import * as fs from 'fs' ;
22import * as path from 'path' ;
3- /* eslint-disable no-console */
43import { sentryVitePlugin } from '@sentry/vite-plugin' ;
54import 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