log-transform
v0.0.3
Published
transform your logger statements
Downloads
5
Readme
log-transform
transform your logger statements
What is this?
log-transform
is a simple node module that transforms found custom logger statements to something beautiful.
Getting started
npm install log-transform
Usage
Transformer takes string as a input and returns a string with the same amount of lines.
var transformer = require('log-transform')(/* options */);
transformer('this.log("hello kids");');
// 'console.log.apply(console, [\'%c\' + \'General\' + \' %c→\', \'color:#4bc800\', \'color:blue\', "hello kids"]);'
var transformer = require('log-transform')({ silent: true });
transformer('this.log("hello kids");');
// ';'
Options
all options are completely optional
- silent [default: false] when true then removes the log statements
- logFn [default: fn(className, text)] function used to replace the found log statement
- className [default: General] default value if no class name can be distinguished
- logMatcher regexp that defines how log statements should be found
- classMatcher regexp that defines how className should be found
- ignoreLinesContains list of simple strings. Lines containing these strings are ignored from processing (performance)
Develop
watches for file changes and reruns tests each time
$ grunt watch
runs spec tests
$ grunt test
produces coverage report (needs explicit piping)
$ grunt cov
License
BSD