1.0.0 • Published 4 years ago

@daniel-del-castillo/add-logging v1.0.0

Weekly downloads
194
License
Unlicense
Repository
github
Last release
4 years ago

add-logging

Daniel del Castillo de la Rosa

add-logging is a package that allows to add logs to javascript code. You can use the binary or call the function addLogging in your code.

Usage as executable:

Usage: add-logging [options] <filename>

Adds logs to javascript code

Arguments:
  filename                 file with the original code

Options:
  -V, --version            output the version number
  -o, --output <filename>  file in which to write the output (default: "output.js")
  -p, --pattern <pattern>  regexp pattern that matchs the desired functions
  -h, --help               display help for command

Usage from code:

const addLogging = require('add-logging');
//call the function

The documention of the function.

Example of changes made:

function foo(a, b) {
    var x = 'blah';
    var y = (function (z) {
        return z+3;
    })(2);
}
foo(1, 'wut', 3);
function foo(a, b) {
    console.log(`Entering foo(${ a }, ${ b }) at line 1`);
    var x = 'blah';
    var y = function (z) {
        console.log(`Entering <anonymous function>(${ z }) at line 3`);
        return z + 3;
    }(2);
}
foo(1, 'wut', 3);

Installation

npm install @daniel-del-castillo/add-logging --save

Tests

You should be able to run the tests using:

npm i && npm run cov
1.0.0

4 years ago

0.4.1

4 years ago

0.3.3

4 years ago

0.3.2

4 years ago

0.3.1

4 years ago

0.3.0

4 years ago

0.2.0

4 years ago

0.1.0

4 years ago