log-helpers
v1.0.1
Published
A collection of logging helpers including some functional programming utilities
Downloads
5
Maintainers
Readme
Log Helpers
A few log helpers utilities. These are the simpler helpers:
l
, short forconsole.log
i
, short forconsole.info
w
, short forconsole.warn
e
, short forconsole.error
And a logger function to help when inside compose
or pipe
-like functions that required curried functions.
ll
Examples
The simpler l
, i
, w
and e
helpers are used simply like this:
const mystr = 'may the force';
l('value of the string', mystr);
# or
w('invalid input, using default value');
The Curried ll
The ll
function can be used inside function composition situations that require curried functions. In such cases, the simpler console.log
function and its variants don't work and therefore we need a curried version of the logger functions.
Suppose you are using Ramda's pipe
function:
pipe(
prop('langs'),
ll('value of langs'), // <1>
toUpper,
);
- You use the
ll
helper passing a label parameter to help identify the log on the console, andpipe
takes care of passing the value to thell
function.