All files / src/browser/shared logger.ts

0% Statements 0/8
0% Branches 0/6
0% Functions 0/4
0% Lines 0/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                                                             
/**
 * @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 {
    if (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);
  },
};