pipable-logdeprecated

Pipable, plugable log function

Usage no npm install needed!

<script type="module">
  import pipableLog from 'https://cdn.skypack.dev/pipable-log';
</script>

README

pipable-log

npm version gzip size gzip size

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 the pipe method of an RxJS observable.


Contributing guidelines