Home / Function/ reenableLogs() — react Function Reference

reenableLogs() — react Function Reference

Architecture documentation for the reenableLogs() function in DevToolsConsolePatching.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  fab04a66_3601_314a_508c_0c0ed218e0c8["reenableLogs()"]
  9a81e06e_974e_e81d_602d_eef62dec4440["DevToolsConsolePatching.js"]
  fab04a66_3601_314a_508c_0c0ed218e0c8 -->|defined in| 9a81e06e_974e_e81d_602d_eef62dec4440
  style fab04a66_3601_314a_508c_0c0ed218e0c8 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-devtools-shared/src/backend/shared/DevToolsConsolePatching.js lines 62–88

export function reenableLogs(): void {
  disabledDepth--;
  if (disabledDepth === 0) {
    const props = {
      configurable: true,
      enumerable: true,
      writable: true,
    };
    // $FlowFixMe[cannot-write] Flow thinks console is immutable.
    Object.defineProperties(console, {
      log: {...props, value: prevLog},
      info: {...props, value: prevInfo},
      warn: {...props, value: prevWarn},
      error: {...props, value: prevError},
      group: {...props, value: prevGroup},
      groupCollapsed: {...props, value: prevGroupCollapsed},
      groupEnd: {...props, value: prevGroupEnd},
    });
    /* eslint-enable react-internal/no-production-logging */
  }
  if (disabledDepth < 0) {
    console.error(
      'disabledDepth fell below zero. ' +
        'This is a bug in React. Please file an issue.',
    );
  }
}

Domain

Subdomains

Frequently Asked Questions

What does reenableLogs() do?
reenableLogs() is a function in the react codebase, defined in packages/react-devtools-shared/src/backend/shared/DevToolsConsolePatching.js.
Where is reenableLogs() defined?
reenableLogs() is defined in packages/react-devtools-shared/src/backend/shared/DevToolsConsolePatching.js at line 62.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free