API Reference / @dasch-ng/rxjs-operators / debug
Function: debug()
debug<
T>(label?): (source) =>Observable<T>
Defined in: debug-operator.ts:26
A debugging operator that logs all notifications (next, error, complete) from an observable stream. Useful for development and troubleshooting.
Type Parameters
T
T
The type of values emitted by the source observable
Parameters
label?
string
Optional string label to identify the stream in console output
Returns
An operator function that logs all notifications and passes them through unchanged
(
source):Observable<T>
Parameters
source
Observable<T>
Returns
Observable<T>
Example
typescript
import { of } from 'rxjs';
import { debug } from '@dasch-ng/rxjs-operators';
of(1, 2, 3)
.pipe(debug('my-stream'))
.subscribe();
// Console output (RxJS Notification objects):
// my-stream Notification { kind: 'N', value: 1, error: undefined, hasValue: true }
// my-stream Notification { kind: 'N', value: 2, error: undefined, hasValue: true }
// my-stream Notification { kind: 'N', value: 3, error: undefined, hasValue: true }
// my-stream Notification { kind: 'C', value: undefined, error: undefined, hasValue: false }