@@ -23,7 +23,7 @@ import type {
23
23
import type { UnpluginContextMeta , UnpluginInstance , UnpluginOptions } from 'unplugin' ;
24
24
import { createUnplugin } from 'unplugin' ;
25
25
26
- import { getContext , validateOptions } from './helpers' ;
26
+ import { getContext , getLoggerFactory , validateOptions } from './helpers' ;
27
27
28
28
/* eslint-disable arca/import-ordering, arca/newline-after-import-section */
29
29
// #imports-injection-marker
@@ -77,33 +77,52 @@ export const buildPluginFactory = ({
77
77
version,
78
78
} ) ;
79
79
80
+ const getLogger = getLoggerFactory ( context . build , options . logLevel ) ;
81
+
80
82
context . pluginNames . push ( HOST_NAME ) ;
81
83
82
84
// List of plugins to be returned.
83
85
// We keep the UnpluginOptions type for the custom plugins.
84
86
const plugins : ( PluginOptions | UnpluginOptions ) [ ] = [
85
87
// Prefill with our internal plugins.
86
88
// #internal-plugins-injection-marker
87
- ...getBuildReportPlugins ( context ) ,
89
+ ...getBuildReportPlugins ( context , getLogger ( 'datadog-build-report-plugin' ) ) ,
88
90
...getBundlerReportPlugins ( context ) ,
89
91
...getGitPlugins ( options , context ) ,
90
- ...getInjectionPlugins ( bundler , context , injections ) ,
92
+ ...getInjectionPlugins (
93
+ bundler ,
94
+ context ,
95
+ injections ,
96
+ getLogger ( 'datadog-injection-plugin' ) ,
97
+ ) ,
91
98
// #internal-plugins-injection-marker
92
99
] ;
93
100
94
101
// Add custom, on the fly plugins, if any.
95
102
if ( options . customPlugins ) {
96
- const customPlugins = options . customPlugins ( options , context ) ;
103
+ const customPlugins = options . customPlugins (
104
+ options ,
105
+ context ,
106
+ getLogger ( 'datadog-custom-plugins' ) ,
107
+ ) ;
97
108
plugins . push ( ...customPlugins ) ;
98
109
}
99
110
100
111
// Based on configuration add corresponding plugin.
101
112
// #configs-injection-marker
102
113
if ( options [ rum . CONFIG_KEY ] && options [ rum . CONFIG_KEY ] . disabled !== true ) {
103
- plugins . push ( ...rum . getPlugins ( options as OptionsWithRum , context ) ) ;
114
+ plugins . push (
115
+ ...rum . getPlugins ( options as OptionsWithRum , context , getLogger ( rum . PLUGIN_NAME ) ) ,
116
+ ) ;
104
117
}
105
118
if ( options [ telemetry . CONFIG_KEY ] && options [ telemetry . CONFIG_KEY ] . disabled !== true ) {
106
- plugins . push ( ...telemetry . getPlugins ( options as OptionsWithTelemetry , context ) ) ;
119
+ plugins . push (
120
+ ...telemetry . getPlugins (
121
+ options as OptionsWithTelemetry ,
122
+ context ,
123
+ getLogger ( telemetry . PLUGIN_NAME ) ,
124
+ ) ,
125
+ ) ;
107
126
}
108
127
// #configs-injection-marker
109
128
0 commit comments