All files / proxy/utils log.ts

80% Statements 4/5
50% Branches 2/4
100% Functions 2/2
75% Lines 3/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15                62x 62x     430x    
import type { CloudFrontRequest } from 'aws-lambda'
import { getHeaderValue } from './headers.ts'
 
/**
 * This function depends on 'fpjs_debug' boolean value, determining whether debug logs are going to be logged or not.
 * @param request {CloudFrontRequest}
 */
export function setLogLevel(request?: CloudFrontRequest) {
  const debugValue = request ? getHeaderValue(request, 'fpjs_debug') : undefined
  Iif (debugValue === 'true') {
    return
  }
  console.debug = () => null
}