Skip to content

Commit f54d641

Browse files
committed
cleanup, remove unnecessary log
1 parent 75fc4d2 commit f54d641

File tree

5 files changed

+19
-27
lines changed

5 files changed

+19
-27
lines changed

packages/browser-utils/src/metrics/cls.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ function sendStandaloneClsSpan(
7979
}
8080

8181
const span = startStandaloneWebVitalSpan({
82-
type: 'cls',
8382
name,
8483
transaction: routeName,
8584
attributes,

packages/browser-utils/src/metrics/inp.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ export const _onInp: InstrumentationHandlerCallback = ({ metric }) => {
129129
};
130130

131131
const span = startStandaloneWebVitalSpan({
132-
type: 'inp',
133132
name,
134133
transaction: routeName,
135134
attributes,

packages/browser-utils/src/metrics/lcp.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ export function _sendStandaloneLcpSpan(
9292
}
9393

9494
const span = startStandaloneWebVitalSpan({
95-
type: 'lcp',
9695
name,
9796
transaction: routeName,
9897
attributes,

packages/browser-utils/src/metrics/utils.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ import type {
77
SpanTimeInput,
88
StartSpanOptions,
99
} from '@sentry/core';
10-
import { debug, getClient, getCurrentScope, spanToJSON, startInactiveSpan, withActiveSpan } from '@sentry/core';
11-
import { DEBUG_BUILD } from '../debug-build';
10+
import { getClient, getCurrentScope, spanToJSON, startInactiveSpan, withActiveSpan } from '@sentry/core';
1211
import { WINDOW } from '../types';
1312
import { onHidden } from './web-vitals/lib/onHidden';
1413

@@ -56,7 +55,6 @@ export function startAndEndSpan(
5655
}
5756

5857
interface StandaloneWebVitalSpanOptions {
59-
type: 'lcp' | 'cls' | 'inp';
6058
name: string;
6159
transaction?: string;
6260
attributes: SpanAttributes;
@@ -85,7 +83,7 @@ export function startStandaloneWebVitalSpan(options: StandaloneWebVitalSpanOptio
8583
return;
8684
}
8785

88-
const { name, transaction, attributes: passedAttributes, startTime, type } = options;
86+
const { name, transaction, attributes: passedAttributes, startTime } = options;
8987

9088
const { release, environment, sendDefaultPii } = client.getOptions();
9189
// We need to get the replay, user, and activeTransaction from the current scope
@@ -127,9 +125,6 @@ export function startStandaloneWebVitalSpan(options: StandaloneWebVitalSpanOptio
127125
...passedAttributes,
128126
};
129127

130-
DEBUG_BUILD &&
131-
debug.log('Starting standalone web vital span', { type, name, transaction, startTime }, 'attributes:', attributes);
132-
133128
return startInactiveSpan({
134129
name,
135130
attributes,

packages/core/src/client.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ import { dsnToString, makeDsn } from './utils/dsn';
3737
import { addItemToEnvelope, createAttachmentEnvelopeItem } from './utils/envelope';
3838
import { getPossibleEventMessages } from './utils/eventUtils';
3939
import { isParameterizedString, isPlainObject, isPrimitive, isThenable } from './utils/is';
40-
import { logger } from './utils/logger';
40+
import { debug } from './utils/logger';
4141
import { merge } from './utils/merge';
4242
import { checkOrSetAlreadyCaught, uuid4 } from './utils/misc';
4343
import { parseSampleRate } from './utils/parseSampleRate';
@@ -154,7 +154,7 @@ export abstract class Client<O extends ClientOptions = ClientOptions> {
154154
if (options.dsn) {
155155
this._dsn = makeDsn(options.dsn);
156156
} else {
157-
DEBUG_BUILD && logger.warn('No DSN provided, client will not send events.');
157+
DEBUG_BUILD && debug.warn('No DSN provided, client will not send events.');
158158
}
159159

160160
if (this._dsn) {
@@ -182,7 +182,7 @@ export abstract class Client<O extends ClientOptions = ClientOptions> {
182182

183183
// ensure we haven't captured this very object before
184184
if (checkOrSetAlreadyCaught(exception)) {
185-
DEBUG_BUILD && logger.log(ALREADY_SEEN_ERROR);
185+
DEBUG_BUILD && debug.log(ALREADY_SEEN_ERROR);
186186
return eventId;
187187
}
188188

@@ -237,7 +237,7 @@ export abstract class Client<O extends ClientOptions = ClientOptions> {
237237

238238
// ensure we haven't captured this very object before
239239
if (hint?.originalException && checkOrSetAlreadyCaught(hint.originalException)) {
240-
DEBUG_BUILD && logger.log(ALREADY_SEEN_ERROR);
240+
DEBUG_BUILD && debug.log(ALREADY_SEEN_ERROR);
241241
return eventId;
242242
}
243243

@@ -429,15 +429,15 @@ export abstract class Client<O extends ClientOptions = ClientOptions> {
429429
if ('aggregates' in session) {
430430
const sessionAttrs = session.attrs || {};
431431
if (!sessionAttrs.release && !clientReleaseOption) {
432-
DEBUG_BUILD && logger.warn(MISSING_RELEASE_FOR_SESSION_ERROR);
432+
DEBUG_BUILD && debug.warn(MISSING_RELEASE_FOR_SESSION_ERROR);
433433
return;
434434
}
435435
sessionAttrs.release = sessionAttrs.release || clientReleaseOption;
436436
sessionAttrs.environment = sessionAttrs.environment || clientEnvironmentOption;
437437
session.attrs = sessionAttrs;
438438
} else {
439439
if (!session.release && !clientReleaseOption) {
440-
DEBUG_BUILD && logger.warn(MISSING_RELEASE_FOR_SESSION_ERROR);
440+
DEBUG_BUILD && debug.warn(MISSING_RELEASE_FOR_SESSION_ERROR);
441441
return;
442442
}
443443
session.release = session.release || clientReleaseOption;
@@ -465,7 +465,7 @@ export abstract class Client<O extends ClientOptions = ClientOptions> {
465465
// would be `Partial<Record<SentryRequestType, Partial<Record<Outcome, number>>>>`
466466
// With typescript 4.1 we could even use template literal types
467467
const key = `${reason}:${category}`;
468-
DEBUG_BUILD && logger.log(`Recording outcome: "${key}"${count > 1 ? ` (${count} times)` : ''}`);
468+
DEBUG_BUILD && debug.log(`Recording outcome: "${key}"${count > 1 ? ` (${count} times)` : ''}`);
469469
this._outcomes[key] = (this._outcomes[key] || 0) + count;
470470
}
471471
}
@@ -877,12 +877,12 @@ export abstract class Client<O extends ClientOptions = ClientOptions> {
877877

878878
if (this._isEnabled() && this._transport) {
879879
return this._transport.send(envelope).then(null, reason => {
880-
DEBUG_BUILD && logger.error('Error while sending envelope:', reason);
880+
DEBUG_BUILD && debug.error('Error while sending envelope:', reason);
881881
return reason;
882882
});
883883
}
884884

885-
DEBUG_BUILD && logger.error('Transport disabled');
885+
DEBUG_BUILD && debug.error('Transport disabled');
886886

887887
return resolvedSyncPromise({});
888888
}
@@ -1032,7 +1032,7 @@ export abstract class Client<O extends ClientOptions = ClientOptions> {
10321032
isolationScope = getIsolationScope(),
10331033
): PromiseLike<string | undefined> {
10341034
if (DEBUG_BUILD && isErrorEvent(event)) {
1035-
logger.log(`Captured error event \`${getPossibleEventMessages(event)[0] || '<unknown>'}\``);
1035+
debug.log(`Captured error event \`${getPossibleEventMessages(event)[0] || '<unknown>'}\``);
10361036
}
10371037

10381038
return this._processEvent(event, hint, currentScope, isolationScope).then(
@@ -1042,11 +1042,11 @@ export abstract class Client<O extends ClientOptions = ClientOptions> {
10421042
reason => {
10431043
if (DEBUG_BUILD) {
10441044
if (_isDoNotSendEventError(reason)) {
1045-
logger.log(reason.message);
1045+
debug.log(reason.message);
10461046
} else if (_isInternalError(reason)) {
1047-
logger.warn(reason.message);
1047+
debug.warn(reason.message);
10481048
} else {
1049-
logger.warn(reason);
1049+
debug.warn(reason);
10501050
}
10511051
}
10521052
return undefined;
@@ -1207,22 +1207,22 @@ export abstract class Client<O extends ClientOptions = ClientOptions> {
12071207
* Sends client reports as an envelope.
12081208
*/
12091209
protected _flushOutcomes(): void {
1210-
DEBUG_BUILD && logger.log('Flushing outcomes...');
1210+
DEBUG_BUILD && debug.log('Flushing outcomes...');
12111211

12121212
const outcomes = this._clearOutcomes();
12131213

12141214
if (outcomes.length === 0) {
1215-
DEBUG_BUILD && logger.log('No outcomes to send');
1215+
DEBUG_BUILD && debug.log('No outcomes to send');
12161216
return;
12171217
}
12181218

12191219
// This is really the only place where we want to check for a DSN and only send outcomes then
12201220
if (!this._dsn) {
1221-
DEBUG_BUILD && logger.log('No dsn provided, will not send outcomes');
1221+
DEBUG_BUILD && debug.log('No dsn provided, will not send outcomes');
12221222
return;
12231223
}
12241224

1225-
DEBUG_BUILD && logger.log('Sending outcomes:', outcomes);
1225+
DEBUG_BUILD && debug.log('Sending outcomes:', outcomes);
12261226

12271227
const envelope = createClientReportEnvelope(outcomes, this._options.tunnel && dsnToString(this._dsn));
12281228

0 commit comments

Comments
 (0)