3.1.0 • Published 5 years ago
pipable-log v3.1.0
pipable-log
Pipable, plugable log function.
Installing
yarn add pipable-logor
npm install pipable-log --savelog
The library provides a function log which takes any number of plugins as arguments and returns a function that you can use to wrap a value without changing the behavior of your program, so log(plugin1, plugin2, ...)(value) would be equivalent to just value. This shape of the logger has two advantages:
It is convenient to work with a single multi-purpose logger function that you can re-define, for example by putting
const log = <a logger that is conditionally disabled or prefixes all messages with a badge>at the start of a module.log(...)can be inserted into a pipe such as one built with the pipeline operator ponyfill from Antiutils library or one built with thepipemethod of an RxJS observable.