All files / src/browser/shared logger.ts

50% Statements 4/8
50% Branches 3/6
50% Functions 2/4
66.66% Lines 4/6

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 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31                          5x     5x   11x                 12x      
/**
 * @module Shared/Logger
 * @description Debug logger gated by ?debug URL parameter.
 * Only logs when debug mode is enabled to keep production console clean.
 
 *
 * @intelligence Intelligence operations monitoring — conditional debug logging (?debug URL parameter) for production diagnostics without exposing operational details. Supports incident analysis and performance investigation.
 *
 * @business Operational cost reduction — debug-gated logging keeps production console clean, reducing noise in error monitoring. Enables field debugging for support teams without code changes or redeployment.
 *
 * @marketing Developer experience feature — debug mode is demonstrable in technical blog posts and documentation. Positions the platform as developer-friendly for open-source community engagement.
 * */
 
const isDebug = typeof window !== 'undefined' &&
  new URLSearchParams(window.location?.search).has('debug');
 
export const logger = {
  debug(...args: unknown[]): void {
    Iif (isDebug) console.debug('[RDM]', ...args);
  },
  info(...args: unknown[]): void {
    if (isDebug) console.info('[RDM]', ...args);
  },
  warn(...args: unknown[]): void {
    console.warn('[RDM]', ...args);
  },
  error(...args: unknown[]): void {
    console.error('[RDM]', ...args);
  },
};