Skip to content

Instantly share code, notes, and snippets.

@Coly010
Created March 4, 2021 11:01
Show Gist options
  • Select an option

  • Save Coly010/6c5bd73780f4aa0389cd78796a4bef59 to your computer and use it in GitHub Desktop.

Select an option

Save Coly010/6c5bd73780f4aa0389cd78796a4bef59 to your computer and use it in GitHub Desktop.
//We can add a label to the logs:
const obs$ = of('my test value');
obs$.pipe(debug('Obserable A')).subscribe();
// OUTPUT:
// Obserable A my test value
// We can label it using the config object syntax:
const obs$ = of('my test value');
obs$.pipe(debug({ label: 'Obserable A' })).subscribe();
// OUTPUT:
// Obserable A my test value
// However, if we add a label and custom notification handlers,
// we will not get the label in the logs by default:
const obs$ = of('my test value');
obs$
.pipe(
debug({
label: 'Obserable A',
next: (value) => console.log(value),
})
)
.subscribe();
// OUTPUT:
// my test value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment