Function logValues

  • Logs values, errors and completion to the console, and passes them all along unchanged.

    of(1, 2).pipe(logValues()).subscribe();
    // prints using console.log:
    // [value] 1
    // [value] 2
    // [complete]

    of(1, 2).pipe(logValues("my number", "debug")).subscribe();
    // prints using console.debug:
    // [value] my number 1
    // [value] my number 2
    // [complete] my number

    throwError("boo").pipe(logValues("pipe says", "warn")).subscribe();
    // prints using console.warn:
    // [error] pipe says boo

    Type Parameters

    • T

    Parameters

    • Optional prefix: string
    • level: "error" | "debug" | "info" | "log" | "trace" | "warn" = 'log'

    Returns MonoTypeOperatorFunction<T>