Skip to content

Commit febe9ce

Browse files
author
Luca Forstner
authored
feat(core): Add loggerPrefixOverride meta option (#506)
1 parent 0274c82 commit febe9ce

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

packages/bundler-plugin-core/src/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ export function sentryUnpluginFactory({
7272
}: SentryUnpluginFactoryOptions) {
7373
return createUnplugin<Options | undefined, true>((userOptions = {}, unpluginMetaContext) => {
7474
const logger = createLogger({
75-
prefix: `[sentry-${unpluginMetaContext.framework}-plugin]`,
75+
prefix:
76+
userOptions._metaOptions?.loggerPrefixOverride ??
77+
`[sentry-${unpluginMetaContext.framework}-plugin]`,
7678
silent: userOptions.silent ?? false,
7779
debug: userOptions.debug ?? false,
7880
});

packages/bundler-plugin-core/src/types.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,19 @@ export interface Options {
320320
// eslint-disable-next-line @typescript-eslint/no-explicit-any
321321
moduleMetadata?: any | ModuleMetadataCallback;
322322
};
323+
324+
/**
325+
* Options that are useful for building wrappers around the plugin. You likely don't need these options unless you
326+
* are distributing a tool that depends on this plugin
327+
*/
328+
_metaOptions?: {
329+
/**
330+
* Overrides the prefix that come before logger messages. (e.g. `[some-prefix] Info: Some log message`)
331+
*
332+
* Example value: `[sentry-webpack-plugin (client)]`
333+
*/
334+
loggerPrefixOverride?: string;
335+
};
323336
}
324337

325338
export interface ModuleMetadataCallbackArgs {

0 commit comments

Comments
 (0)