Function createLogger

  • Returns a component's logger: a guard over the logger the current target gives. With a factory set, it calls the factory at once; otherwise it takes a child of the default root, or an adapter over the logger or the silence set now, and that logger keeps its target after a later setter. The guard's calls reach that logger, with the caller's arguments, until content-safe telemetry is enabled; from then on each call becomes one fixed event for the host's sink, even on a logger made earlier, and child returns the same logger. While the mode is on, the factory is not called and nothing is made.

    Parameters

    • name: string

      The component's name.

    • Optional bindings: Record<string, any>

      Bindings for every line the logger writes.

    Returns ILogger

    The component's logger.