@alu0101230948/addlogging
v1.3.0
Published
Espree Logging ==============
Downloads
11
Readme
Espree Logging
A small library providing utility methods to addLogging
to a code, meaning that it introduces a console.log
after every function definition.
Installation
npm install @alu0101230948/addlogging --save
Usage
Use the provided executable
add-logging --pattern 'temperature' --output output.js input.js
Use it in your code
addLogging = require('@alu0101230948/addlogging').addLogging;
let input = `function foo(a, b) {
var x = 'blah';
var y = (function () {
return 3;
})();
}
foo(1, 'wut', 3);`
/* Expected output
function foo(a, b) {
console.log('Entering foo(\${ a },\${ b }) at line 1');
var x = 'blah';
var y = function () {
console.log('Entering <anonymous function>() at line 3');
return 3;
}();
}
foo(1, 'wut', 3);
*/
Features
- Command line arguments (-o, -V, -h, -p).
- Compatible with ES6! (Arrow functions).
- Regex Support for the pattern.
- Multiple files can be added and the output will be appended in the output file if indicated.
Tests
npm test
Contributing
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.
Release History
- 1.0.0 Initial release
- 1.0.1 Patch fix: documentation mistakes
- 1.0.2 Minor bugs fixed
- 1.0.3 Minor bugs fixed
- 1.1.0 Added Regex pattern compatibility
- 1.2.0 Added possibility of indicating multiple input files
- 1.3.0 If a directory is specified with '/' at the end, it will take all files and perform addLogging to them