@@ -295,23 +295,27 @@ function makeExpressHandler(appId, promiseHandler) {
295295 return function ( req , res , next ) {
296296 try {
297297 ( function ( ) {
298- var url = maskSensitiveUrl ( req ) ;
299- var body = maskSensitiveBody ( req ) ;
300- var stringifiedBody = JSON . stringify ( body , null , 2 ) ;
301- _logger2 . default . verbose ( 'REQUEST for [' + req . method + '] ' + url + ': ' + stringifiedBody , {
302- method : req . method ,
303- url : url ,
304- headers : req . headers ,
305- body : body
306- } ) ;
298+ var url = void 0 ;
299+ if ( process . env . VERBOSE ) {
300+ url = maskSensitiveUrl ( req ) ;
301+ var body = maskSensitiveBody ( req ) ;
302+ var stringifiedBody = JSON . stringify ( body , null , 2 ) ;
303+ _logger2 . default . verbose ( 'REQUEST for [' + req . method + '] ' + url + ': ' + stringifiedBody , {
304+ method : req . method ,
305+ url : url ,
306+ headers : req . headers ,
307+ body : body
308+ } ) ;
309+ }
307310 promiseHandler ( req ) . then ( function ( result ) {
308311 if ( ! result . response && ! result . location && ! result . text ) {
309312 _logger2 . default . error ( 'the handler did not include a "response" or a "location" field' ) ;
310313 throw 'control should not get here' ;
311314 }
312-
313- var stringifiedResponse = JSON . stringify ( result , null , 2 ) ;
314- _logger2 . default . verbose ( 'RESPONSE from [' + req . method + '] ' + url + ': ' + stringifiedResponse , { result : result } ) ;
315+ if ( process . env . VERBOSE ) {
316+ var stringifiedResponse = JSON . stringify ( result , null , 2 ) ;
317+ _logger2 . default . verbose ( 'RESPONSE from [' + req . method + '] ' + url + ': ' + stringifiedResponse , { result : result } ) ;
318+ }
315319
316320 var status = result . status || 200 ;
317321 res . status ( status ) ;
0 commit comments