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
@@ -59,18 +58,18 @@ export const sentryAstro = (options: SentryOptions = {}): AstroIntegration => {
5958 : findDefaultSdkInitFile ( 'server' ) ;
6059
6160 if ( pathToClientInit ) {
62- options . debug && console . log ( `[sentry-astro] Using ${ pathToClientInit } for client init.`) ;
61+ options . debug && logger . info ( ` Using ${ pathToClientInit } for client init.`) ;
6362 injectScript ( 'page' , buildSdkInitFileImportSnippet ( pathToClientInit ) ) ;
6463 } else {
65- options . debug && console . log ( '[sentry-astro] Using default client init.' ) ;
64+ options . debug && logger . info ( '[sentry-astro] Using default client init.' ) ;
6665 injectScript ( 'page' , buildClientSnippet ( options || { } ) ) ;
6766 }
6867
6968 if ( pathToServerInit ) {
70- options . debug && console . log ( `[sentry-astro] Using ${ pathToServerInit } for server init.`) ;
69+ options . debug && logger . info ( ` Using ${ pathToServerInit } for server init.`) ;
7170 injectScript ( 'page-ssr' , buildSdkInitFileImportSnippet ( pathToServerInit ) ) ;
7271 } else {
73- options . debug && console . log ( '[sentry-astro] Using default server init.') ;
72+ options . debug && logger . info ( ' Using default server init.') ;
7473 injectScript ( 'page-ssr' , buildServerSnippet ( options || { } ) ) ;
7574 }
7675
0 commit comments