@@ -12,6 +12,7 @@ import type { AggregationCounts, Client, SanitizedRequestData, Scope } from '@se
1212import {
1313 addBreadcrumb ,
1414 addNonEnumerableProperty ,
15+ debug ,
1516 generateSpanId ,
1617 getBreadcrumbLogLevelFromHttpStatusCode ,
1718 getClient ,
@@ -21,7 +22,6 @@ import {
2122 getTraceData ,
2223 httpRequestToRequestData ,
2324 isError ,
24- logger ,
2525 LRUMap ,
2626 parseUrl ,
2727 SDK_VERSION ,
@@ -219,7 +219,7 @@ export class SentryHttpInstrumentation extends InstrumentationBase<SentryHttpIns
219219 * It has access to the final request and response objects.
220220 */
221221 private _onOutgoingRequestFinish ( request : http . ClientRequest , response ?: http . IncomingMessage ) : void {
222- DEBUG_BUILD && logger . log ( INSTRUMENTATION_NAME , 'Handling finished outgoing request' ) ;
222+ DEBUG_BUILD && debug . log ( INSTRUMENTATION_NAME , 'Handling finished outgoing request' ) ;
223223
224224 const _breadcrumbs = this . getConfig ( ) . breadcrumbs ;
225225 const breadCrumbsEnabled = typeof _breadcrumbs === 'undefined' ? true : _breadcrumbs ;
@@ -266,10 +266,10 @@ export class SentryHttpInstrumentation extends InstrumentationBase<SentryHttpIns
266266 if ( sentryTrace && ! request . getHeader ( 'sentry-trace' ) ) {
267267 try {
268268 request . setHeader ( 'sentry-trace' , sentryTrace ) ;
269- DEBUG_BUILD && logger . log ( INSTRUMENTATION_NAME , 'Added sentry-trace header to outgoing request' ) ;
269+ DEBUG_BUILD && debug . log ( INSTRUMENTATION_NAME , 'Added sentry-trace header to outgoing request' ) ;
270270 } catch ( error ) {
271271 DEBUG_BUILD &&
272- logger . error (
272+ debug . error (
273273 INSTRUMENTATION_NAME ,
274274 'Failed to add sentry-trace header to outgoing request:' ,
275275 isError ( error ) ? error . message : 'Unknown error' ,
@@ -283,10 +283,10 @@ export class SentryHttpInstrumentation extends InstrumentationBase<SentryHttpIns
283283 if ( newBaggage ) {
284284 try {
285285 request . setHeader ( 'baggage' , newBaggage ) ;
286- DEBUG_BUILD && logger . log ( INSTRUMENTATION_NAME , 'Added baggage header to outgoing request' ) ;
286+ DEBUG_BUILD && debug . log ( INSTRUMENTATION_NAME , 'Added baggage header to outgoing request' ) ;
287287 } catch ( error ) {
288288 DEBUG_BUILD &&
289- logger . error (
289+ debug . error (
290290 INSTRUMENTATION_NAME ,
291291 'Failed to add baggage header to outgoing request:' ,
292292 isError ( error ) ? error . message : 'Unknown error' ,
@@ -309,7 +309,7 @@ export class SentryHttpInstrumentation extends InstrumentationBase<SentryHttpIns
309309 return ;
310310 }
311311
312- DEBUG_BUILD && logger . log ( INSTRUMENTATION_NAME , 'Patching server.emit' ) ;
312+ DEBUG_BUILD && debug . log ( INSTRUMENTATION_NAME , 'Patching server.emit' ) ;
313313
314314 // eslint-disable-next-line @typescript-eslint/no-this-alias
315315 const instrumentation = this ;
@@ -322,7 +322,7 @@ export class SentryHttpInstrumentation extends InstrumentationBase<SentryHttpIns
322322 return target . apply ( thisArg , args ) ;
323323 }
324324
325- DEBUG_BUILD && logger . log ( INSTRUMENTATION_NAME , 'Handling incoming request' ) ;
325+ DEBUG_BUILD && debug . log ( INSTRUMENTATION_NAME , 'Handling incoming request' ) ;
326326
327327 const isolationScope = getIsolationScope ( ) . clone ( ) ;
328328 const request = args [ 1 ] as http . IncomingMessage ;
@@ -467,7 +467,7 @@ function patchRequestToCaptureBody(
467467 let bodyByteLength = 0 ;
468468 const chunks : Buffer [ ] = [ ] ;
469469
470- DEBUG_BUILD && logger . log ( INSTRUMENTATION_NAME , 'Patching request.on' ) ;
470+ DEBUG_BUILD && debug . log ( INSTRUMENTATION_NAME , 'Patching request.on' ) ;
471471
472472 /**
473473 * We need to keep track of the original callbacks, in order to be able to remove listeners again.
@@ -491,7 +491,7 @@ function patchRequestToCaptureBody(
491491
492492 if ( event === 'data' ) {
493493 DEBUG_BUILD &&
494- logger . log ( INSTRUMENTATION_NAME , `Handling request.on("data") with maximum body size of ${ maxBodySize } b` ) ;
494+ debug . log ( INSTRUMENTATION_NAME , `Handling request.on("data") with maximum body size of ${ maxBodySize } b` ) ;
495495
496496 const callback = new Proxy ( listener , {
497497 apply : ( target , thisArg , args : Parameters < typeof listener > ) => {
@@ -503,13 +503,13 @@ function patchRequestToCaptureBody(
503503 chunks . push ( bufferifiedChunk ) ;
504504 bodyByteLength += bufferifiedChunk . byteLength ;
505505 } else if ( DEBUG_BUILD ) {
506- logger . log (
506+ debug . log (
507507 INSTRUMENTATION_NAME ,
508508 `Dropping request body chunk because maximum body length of ${ maxBodySize } b is exceeded.` ,
509509 ) ;
510510 }
511511 } catch ( err ) {
512- DEBUG_BUILD && logger . error ( INSTRUMENTATION_NAME , 'Encountered error while storing body chunk.' ) ;
512+ DEBUG_BUILD && debug . error ( INSTRUMENTATION_NAME , 'Encountered error while storing body chunk.' ) ;
513513 }
514514
515515 return Reflect . apply ( target , thisArg , args ) ;
@@ -561,13 +561,13 @@ function patchRequestToCaptureBody(
561561 }
562562 } catch ( error ) {
563563 if ( DEBUG_BUILD ) {
564- logger . error ( INSTRUMENTATION_NAME , 'Error building captured request body' , error ) ;
564+ debug . error ( INSTRUMENTATION_NAME , 'Error building captured request body' , error ) ;
565565 }
566566 }
567567 } ) ;
568568 } catch ( error ) {
569569 if ( DEBUG_BUILD ) {
570- logger . error ( INSTRUMENTATION_NAME , 'Error patching request to capture body' , error ) ;
570+ debug . error ( INSTRUMENTATION_NAME , 'Error patching request to capture body' , error ) ;
571571 }
572572 }
573573}
@@ -611,7 +611,7 @@ export function recordRequestSession({
611611 const requestSession = requestIsolationScope . getScopeData ( ) . sdkProcessingMetadata . requestSession ;
612612
613613 if ( client && requestSession ) {
614- DEBUG_BUILD && logger . debug ( `Recorded request session with status: ${ requestSession . status } ` ) ;
614+ DEBUG_BUILD && debug . log ( `Recorded request session with status: ${ requestSession . status } ` ) ;
615615
616616 const roundedDate = new Date ( ) ;
617617 roundedDate . setSeconds ( 0 , 0 ) ;
@@ -624,7 +624,7 @@ export function recordRequestSession({
624624 if ( existingClientAggregate ) {
625625 existingClientAggregate [ dateBucketKey ] = bucket ;
626626 } else {
627- DEBUG_BUILD && logger . debug ( 'Opened new request session aggregate.' ) ;
627+ DEBUG_BUILD && debug . log ( 'Opened new request session aggregate.' ) ;
628628 const newClientAggregate = { [ dateBucketKey ] : bucket } ;
629629 clientToRequestSessionAggregatesMap . set ( client , newClientAggregate ) ;
630630
@@ -645,11 +645,11 @@ export function recordRequestSession({
645645 } ;
646646
647647 const unregisterClientFlushHook = client . on ( 'flush' , ( ) => {
648- DEBUG_BUILD && logger . debug ( 'Sending request session aggregate due to client flush' ) ;
648+ DEBUG_BUILD && debug . log ( 'Sending request session aggregate due to client flush' ) ;
649649 flushPendingClientAggregates ( ) ;
650650 } ) ;
651651 const timeout = setTimeout ( ( ) => {
652- DEBUG_BUILD && logger . debug ( 'Sending request session aggregate due to flushing schedule' ) ;
652+ DEBUG_BUILD && debug . log ( 'Sending request session aggregate due to flushing schedule' ) ;
653653 flushPendingClientAggregates ( ) ;
654654 } , sessionFlushingDelayMS ) . unref ( ) ;
655655 }
0 commit comments