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
@@ -59,18 +58,18 @@ export const sentryAstro = (options: SentryOptions = {}): AstroIntegration => {
59
58
: findDefaultSdkInitFile ( 'server' ) ;
60
59
61
60
if ( pathToClientInit ) {
62
- options . debug && console . log ( `[sentry-astro] Using ${ pathToClientInit } for client init.`) ;
61
+ options . debug && logger . info ( ` Using ${ pathToClientInit } for client init.`) ;
63
62
injectScript ( 'page' , buildSdkInitFileImportSnippet ( pathToClientInit ) ) ;
64
63
} else {
65
- options . debug && console . log ( '[sentry-astro] Using default client init.' ) ;
64
+ options . debug && logger . info ( '[sentry-astro] Using default client init.' ) ;
66
65
injectScript ( 'page' , buildClientSnippet ( options || { } ) ) ;
67
66
}
68
67
69
68
if ( pathToServerInit ) {
70
- options . debug && console . log ( `[sentry-astro] Using ${ pathToServerInit } for server init.`) ;
69
+ options . debug && logger . info ( ` Using ${ pathToServerInit } for server init.`) ;
71
70
injectScript ( 'page-ssr' , buildSdkInitFileImportSnippet ( pathToServerInit ) ) ;
72
71
} else {
73
- options . debug && console . log ( '[sentry-astro] Using default server init.') ;
72
+ options . debug && logger . info ( ' Using default server init.') ;
74
73
injectScript ( 'page-ssr' , buildServerSnippet ( options || { } ) ) ;
75
74
}
76
75
0 commit comments