Example 1: Basic Logging
Log emitted values using console.log:
import {logger} from 'ngx-lift';
import {of} from 'rxjs';
of([1, 2, 3]).pipe(logger()).subscribe();
// check your console for result The logger operator is a utility function for RxJS observables that simplifies logging emitted values using different console functions. This operator is useful for debugging and monitoring the behavior of your observables during development.
Log emitted values using console.log:
import {logger} from 'ngx-lift';
import {of} from 'rxjs';
of([1, 2, 3]).pipe(logger()).subscribe();
// check your console for resultLog emitted values using console.table for better visualization:
import {logger} from 'ngx-lift';
import {of} from 'rxjs';
of([1, 1, 2, 2, 3, 4, 4, 5]).pipe(logger('table')).subscribe();
// check your console for table resultUse other console methods like warn, error, or info:
import {logger} from 'ngx-lift';
import {of} from 'rxjs';
of([1, 2, 3]).pipe(logger('warn')).subscribe();
of([1, 2, 3]).pipe(logger('error')).subscribe();
of([1, 2, 3]).pipe(logger('info')).subscribe();RxJS operator that logs emitted values using different console functions.
logger(
method?: 'log' | 'table' | 'warn' | 'error' | 'info' | 'debug'
): MonoTypeOperatorFunction<T>method?: 'log' | 'table' | 'warn' | 'error' | 'info' | 'debug'(Optional) The console method to use for logging. Defaults to 'log'.
Available methods: log, table, warn, error, info, debug.
An observable that passes through all values while logging them to the console.