1
1
import * as fs from 'fs' ;
2
2
import * as path from 'path' ;
3
- /* eslint-disable no-console */
4
3
import { sentryVitePlugin } from '@sentry/vite-plugin' ;
5
4
import type { AstroConfig , AstroIntegration } from 'astro' ;
6
5
@@ -14,7 +13,7 @@ export const sentryAstro = (options: SentryOptions = {}): AstroIntegration => {
14
13
name : PKG_NAME ,
15
14
hooks : {
16
15
// 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 } ) => {
18
17
// The third param here enables loading of all env vars, regardless of prefix
19
18
// see: https://main.vitejs.dev/config/#using-environment-variables-in-config
20
19
@@ -62,10 +61,10 @@ export const sentryAstro = (options: SentryOptions = {}): AstroIntegration => {
62
61
: findDefaultSdkInitFile ( 'client' ) ;
63
62
64
63
if ( pathToClientInit ) {
65
- options . debug && console . log ( `[sentry-astro] Using ${ pathToClientInit } for client init.`) ;
64
+ options . debug && logger . info ( ` Using ${ pathToClientInit } for client init.`) ;
66
65
injectScript ( 'page' , buildSdkInitFileImportSnippet ( pathToClientInit ) ) ;
67
66
} else {
68
- options . debug && console . log ( '[sentry-astro] Using default client init.') ;
67
+ options . debug && logger . info ( ' Using default client init.') ;
69
68
injectScript ( 'page' , buildClientSnippet ( options || { } ) ) ;
70
69
}
71
70
}
@@ -75,10 +74,10 @@ export const sentryAstro = (options: SentryOptions = {}): AstroIntegration => {
75
74
? path . resolve ( options . serverInitPath )
76
75
: findDefaultSdkInitFile ( 'server' ) ;
77
76
if ( pathToServerInit ) {
78
- options . debug && console . log ( `[sentry-astro] Using ${ pathToServerInit } for server init.`) ;
77
+ options . debug && logger . info ( ` Using ${ pathToServerInit } for server init.`) ;
79
78
injectScript ( 'page-ssr' , buildSdkInitFileImportSnippet ( pathToServerInit ) ) ;
80
79
} else {
81
- options . debug && console . log ( '[sentry-astro] Using default server init.') ;
80
+ options . debug && logger . info ( ' Using default server init.') ;
82
81
injectScript ( 'page-ssr' , buildServerSnippet ( options || { } ) ) ;
83
82
}
84
83
}
0 commit comments