Skip to content

Commit 93abae2

Browse files
AleshaOlegLms24
authored andcommitted
Make parameterize function available through browser and node API
1 parent 5f0b506 commit 93abae2

File tree

6 files changed

+7
-14
lines changed

6 files changed

+7
-14
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import { parameterize } from '@sentry/utils';
2-
31
const x = 'first';
42
const y = 'second';
53

6-
Sentry.captureMessage(parameterize`This is a log statement with ${x} and ${y} params`);
4+
Sentry.captureMessage(Sentry.parameterize`This is a log statement with ${x} and ${y} params`);

dev-packages/browser-integration-tests/suites/public-api/captureMessage/parameterized_message/test.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@ import { sentryTest } from '../../../../utils/fixtures';
55
import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers';
66

77
sentryTest('should capture a parameterized representation of the message', async ({ getLocalTestPath, page }) => {
8-
const bundle = process.env.PW_BUNDLE;
9-
10-
if (bundle && bundle.startsWith('bundle_')) {
11-
sentryTest.skip();
12-
}
13-
148
const url = await getLocalTestPath({ testDir: __dirname });
159

1610
const eventData = await getFirstSentryEnvelopeRequest<Event>(page, url);
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import * as Sentry from '@sentry/node';
2-
import { parameterize } from '@sentry/utils';
32

43
Sentry.init({
54
dsn: 'https://[email protected]/1337',
@@ -9,4 +8,4 @@ Sentry.init({
98
const x = 'first';
109
const y = 'second';
1110

12-
Sentry.captureMessage(parameterize`This is a log statement with ${x} and ${y} params`);
11+
Sentry.captureMessage(Sentry.parameterize`This is a log statement with ${x} and ${y} params`);

packages/browser/src/exports.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ export {
7474
inboundFiltersIntegration,
7575
} from '@sentry/core';
7676

77+
export { parameterize } from '@sentry/utils';
78+
7779
export { WINDOW } from './helpers';
7880
export { BrowserClient } from './client';
7981
export { makeFetchTransport, makeXHRTransport } from './transports';

packages/node/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export {
9898
defaultStackParser,
9999
getSentryRelease,
100100
} from './sdk';
101-
export { addRequestDataToEvent, DEFAULT_USER_INCLUDES, extractRequestData } from '@sentry/utils';
101+
export { addRequestDataToEvent, DEFAULT_USER_INCLUDES, extractRequestData, parameterize } from '@sentry/utils';
102102
// eslint-disable-next-line deprecation/deprecation
103103
export { deepReadDirSync } from './utils';
104104

packages/utils/src/parameterize.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import type { ParameterizedString } from '@sentry/types';
33
/**
44
* Tagged template function which returns paramaterized representation of the message
55
* For example: parameterize`This is a log statement with ${x} and ${y} params`, would return:
6-
* "__sentry_template_string__": "My raw message with interpreted strings like %s",
7-
* "__sentry_template_values__": ["this"]
6+
* "__sentry_template_string__": 'This is a log statement with %s and %s params',
7+
* "__sentry_template_values__": ['first', 'second']
88
* @param strings An array of string values splitted between expressions
99
* @param values Expressions extracted from template string
1010
* @returns String with template information in __sentry_template_string__ and __sentry_template_values__ properties

0 commit comments

Comments
 (0)