Home / Function/ getNativeLogFunction() — react Function Reference

getNativeLogFunction() — react Function Reference

Architecture documentation for the getNativeLogFunction() function in capture-param-mutate.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  30b51374_ba3a_8e28_b91b_0a069c24632a["getNativeLogFunction()"]
  9dc9b7ba_e7ec_eabd_38fe_013f280cd904["capture-param-mutate.js"]
  30b51374_ba3a_8e28_b91b_0a069c24632a -->|defined in| 9dc9b7ba_e7ec_eabd_38fe_013f280cd904
  style 30b51374_ba3a_8e28_b91b_0a069c24632a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capture-param-mutate.js lines 1–37

function getNativeLogFunction(level) {
  return function () {
    let str;
    if (arguments.length === 1 && typeof arguments[0] === 'string') {
      str = arguments[0];
    } else {
      str = Array.prototype.map
        .call(arguments, function (arg) {
          return inspect(arg, {
            depth: 10,
          });
        })
        .join(', ');
    }
    const firstArg = arguments[0];
    let logLevel = level;
    if (
      typeof firstArg === 'string' &&
      firstArg.slice(0, 9) === 'Warning: ' &&
      logLevel >= LOG_LEVELS.error
    ) {
      logLevel = LOG_LEVELS.warn;
    }
    if (global.__inspectorLog) {
      global.__inspectorLog(
        INSPECTOR_LEVELS[logLevel],
        str,
        [].slice.call(arguments),
        INSPECTOR_FRAMES_TO_SKIP
      );
    }
    if (groupStack.length) {
      str = groupFormat('', str);
    }
    global.nativeLoggingHook(str, logLevel);
  };
}

Subdomains

Frequently Asked Questions

What does getNativeLogFunction() do?
getNativeLogFunction() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capture-param-mutate.js.
Where is getNativeLogFunction() defined?
getNativeLogFunction() is defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capture-param-mutate.js at line 1.

Analyze Your Own Codebase

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

Try Supermodel Free