1.5.7 • Published 3 years ago

@alu0101051420/addlogging v1.5.7

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

Addlogging ==============

A small library providing a method to add logging messages in existing functions (js).

Installation

npm install addlogging --save

Usage

You can import the main function and use it like this:

const { addLogging } = require('@alu0101051420/addlogging');

let code = `function foo() { var x = 'blah'; } foo();`,
commented = addLogging(code);

console.log('Original Code: \n', code);
console.log('Code with logs: \n', commented);

Output:

Original Code: 
  function foo() { var x = 'blah'; } foo();
Code with logs:
  function foo() {
    console.log(`Entering foo() at line 1`);
    var x = 'blah';
  }   
foo();

An executable is also imported. You must specify an input file, and may or may not specify an output file and/or a name pattern. This pattern will be used to comment only functions whose name match it. (You can specify "anonymous" in order to comment anonymous functions.)

npx addlogging myfile.js
npx addlogging myfile.js --output output.js
npx addlogging myfile.js --output output.js --pattern foo

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.

Tests

npm test

Release History

  • 1.0.0 Initial release
  • 1.4.0 Big changes. Added executable, and --pattern function.
  • 1.5.3 Latest version. Minor bug fixes.
1.5.5

3 years ago

1.5.4

3 years ago

1.5.7

3 years ago

1.5.6

3 years ago

1.4.6

3 years ago

1.4.5

3 years ago

1.5.3

3 years ago

1.4.4

3 years ago

1.5.2

3 years ago

1.5.1

3 years ago

1.4.9

3 years ago

1.4.8

3 years ago

1.4.7

3 years ago

1.4.3

3 years ago

1.4.2

3 years ago

1.4.1

3 years ago

1.4.0

3 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.1.0

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago