1.0.2 • Published 4 years ago

@alu0101163970/addlogging v1.0.2

Weekly downloads
55
License
ISC
Repository
github
Last release
4 years ago

addLogging =========

The function addLogging() insert after an function entering a console.log() function describing the entering function.

Installation

npm i @alu0101163970/addlogging --save

Usage

  • import:

    const { addLogging } = require('addloging')

  • Call function and parameters:

let code = `function foo(a, b) {
    var x = 'blah';
    var y = (function (z) {
      return z+3;
    })(2);
  }
  foo(1, 'wut', 3);`

addLoggin(code);
/////////////////////////////////////
let code = `function foo(a, b) {
    var x = 'blah';
    var y = (function (z) {
      return z+3;
    })(2);
  }
  foo(1, 'wut', 3);`

let pattern = 'foo';

addLoggin(code, pattern);

it returns at first case:

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

it returns at second case:

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

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 README added.
  • 1.0.2 package.json improved.