README
pipable-log
Pipable, plugable log function.
Installing
yarn add pipable-log
or
npm install pipable-log --save
log
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 thepipe
method of an RxJS observable.