@ggcristo/logging-input
v0.4.2
Published
Este programa recibe otro programa en forma de string, el cual modifica añadiendole sentencias ```console.log``` cada vez que se aparece una función.
Downloads
4
Readme
addLogging
Module to apply "printf() debugging"
, trought metaprograming every time you call a function
Installation
npm install @ggcristo/logging-input -g
Usage
add-logging --pattern foo --output salida.js input.js
This read the "input.js" file search and in case the file has valid
javascript in it, search for the funtion whose identifier match with the one you write in the --pattern option, written a console.log on it.
Hipotetic file
function foo(a, b) {
var x = 'blah';
var y = (function () {
return 3;
})();
}
foo(1, 'wut', 3);
Output
function foo(a, b) {
console.log(`Entering foo(${ a }, ${ b }) at line 1`);
var x = 'blah';
var y = function () {
return 3;
}();
}
foo(1, 'wut', 3);
Module Help
~: add-logging
Usage: add-logging [options] <filename> [...]
Metaprogramación con AST
Options:
-V, --version output the version number
-o, --output <filename...> fichero de salida
-h --help output usage information
-p --pattern <pattern> filter the function to process
API usage
This is an one-function module:
addLogging(code, functionNamePattern)
This function take the code in the form of a string (code
), the functionNamePattern
is opcional.
It will return the result code in a form of a string as well.
Tests
npm test
Constributing
Try to use a consist style with the already existing code, avoid monster commits.
If you consider the contribution is big, create a pr and add the tag [WIP] so
others can watch over the process
Release History
- 0.2.0 Initial release
- 0.2.1 Básic test(WIP)
- 0.2.2 Actions
- 0.2.3 Minor bug fixes
- 0.3.0 Executable file
- 0.4.0 Patter option