splat-transform API Reference - v2.0.5
    Preparing search index...

    Variable loggerConst

    logger: {
        bar(name: string, total: number): Bar;
        debug(...args: any[]): void;
        error(...args: any[]): void;
        getVerbosity(): Verbosity;
        group(name: string, options?: { index?: number; total?: number }): Group;
        info(...args: any[]): void;
        output(text: string): void;
        setRenderer(r: Renderer): void;
        setVerbosity(v: Verbosity): void;
        unwindAll(failed?: boolean): void;
        warn(...args: any[]): void;
    } = ...

    Public logger surface.

    Open named, timed scopes with Logger.group. Pass { index, total } to render the group as part of a numbered series. Indeterminate progress is reported with Logger.bar. Free-form messages route through info / warn / error / debug, indented under whatever is on top of the active-scope stack.

    Both group and bar are pure-push operations: opening a new scope simply places it on top of the stack without auto-closing siblings, so call order directly determines nesting. Close scopes with handle.end() after the body. Callers that route failures through Logger.error get scope cleanup for free; embedders that swallow exceptions should call Logger.unwindAll from their catch to close every still-open scope.

    Type Declaration

    • bar: function
      • Open a labelled progress bar nested directly under whatever scope is currently on top of the active-scope stack. Renders as a single line at child indent.

        Like Logger.group, this is a pure-push operation: it does not close any sibling already on the stack. Close with bar.end(), or let an enclosing group's end() / Logger.unwindAll pop it.

        Parameters

        • name: string

          The bar's label.

        • total: number

          Expected number of ticks (or absolute total when using Bar.update).

        Returns Bar

        A handle for advancing and closing the bar.

    • debug: function
      • Emit a debug message. Shown only at verbose verbosity.

        Parameters

        • ...args: any[]

          Message parts.

        Returns void

    • error: function
      • Emit an error message. Always shown, regardless of verbosity. Triggers an automatic unwind of all open scopes, marking each as failed.

        Parameters

        • ...args: any[]

          Message parts.

        Returns void

    • getVerbosity: function
    • group: function
      • Open a named, timed scope. Returns a Group handle. Call end() to close it. Group children indent automatically based on call depth.

        Pass { index, total } to render the group as part of a numbered series (e.g. [2/5] name). Both fields must be supplied together.

        Parameters

        • name: string

          The group name.

        • Optionaloptions: { index?: number; total?: number }

          Optional configuration.

          • Optionalindex?: number

            1-based position in the numbered series.

          • Optionaltotal?: number

            Total length of the numbered series.

        Returns Group

        A handle for closing the group and writing nested log entries.

    • info: function
      • Emit an info message indented under the innermost active scope.

        Parameters

        • ...args: any[]

          Message parts (joined with a space).

        Returns void

    • output: function
      • Emit a logical unit of pipeable output (typically one line, or a multi-line block treated as a single unit). The renderer terminates each unit with a newline, so callers should not include a trailing \n. Always shown, regardless of verbosity.

        Parameters

        • text: string

          The text to emit (without a trailing newline).

        Returns void

    • setRenderer: function
      • Replace the active renderer. Embedders install their own renderer here to consume LogEvents; the default renderer is a no-op. Renderers receive every scope/bar lifecycle event regardless of verbosity, so progress UIs can rely on scopeStart/scopeEnd and barStart/barEnd to manage their state.

        Parameters

        Returns void

    • setVerbosity: function
      • Set verbosity: quiet (errors and warnings), normal (default), verbose (includes debug).

        Parameters

        Returns void

    • unwindAll: function
      • Close every open scope and bar, optionally marking them as failed. Use this from an embedder's catch when an exception is being swallowed (rather than rethrown into a logger.error() call), to prevent dangling scopes from corrupting subsequent output.

        Parameters

        • failed: boolean = false

          When true, mark every closed scope as having failed.

        Returns void

    • warn: function
      • Emit a warning indented under the innermost active scope.

        Parameters

        • ...args: any[]

          Message parts.

        Returns void