UNPKG

@alu0101265704/addlogging

Version:

[![npm version](https://badge.fury.io/js/%40alu0101265704%2Faddlogging.svg)](https://badge.fury.io/js/%40alu0101265704%2Faddlogging)

87 lines (62 loc) 3.03 kB
[![npm version](https://badge.fury.io/js/%40alu0101265704%2Faddlogging.svg)](https://badge.fury.io/js/%40alu0101265704%2Faddlogging) # **Addlogging** Module that provides an `addlogging` method, which from a given JavaScript function,adds logging messages before the entire code declaration begins. * [API Documentation](https://ull-esit-pl-2021.github.io/espree-logging-module-vanessavvp/) * [Installation](#id2) * [Usage](#id3) * [Importing it to the project](#id7) * [Options](#id6) * [Tests](#id4) * [Contributing](#id5) ## **Installation**<a name="id2"></a> ### **Install globally** ```console npm install -g @alu0101265704/addlogging ``` ### **Install locally** ```console npm install @alu0101265704/addlogging ``` ## **Usage**<a name="id3"></a> ### **Importing it to the project**<a name="id7"></a> For the module to be used, you will only need it to be imported into your development project, like for example: ```console const test = require('@alu0101265704/addlogging'); ... const result = test.addLogging(inputCode, patternName); ... ``` ### **Execution options**<a name="id6"></a> **IMPORTANT:** If you want to execute directly from your command line, you must have installed this package as globally in your system, in that case you be able to execute `add-logging` with differents arguments as follows: * `add-logging -h, --help` Using the option `help`, will show how many options you will be able to use with the executable and how it works. ```console add-logging -h Usage: add-logging add-logging [options] Options: -V, --version output the version number -o, --output <output_file> output file of the program -p, --pattern <pattern_name> <output_file> <input_file> function pattern name and output file of the program -h, --help display help for command ``` * `add-logging -V, --version` Using the option `version`, will show the version of the module. ```console add-logging --version 1.1.2 ``` * `add-logging -p, --pattern` Using the option `pattern` followed by a pattern name (string), output file path and input file path, the program will be executed but only by adding lines in those functions which are the same as the pattern name, and finally write those results in the output file. ```console add-logging -p 'multiply' output/output.js input/input1.js Output in file 'output/output.js ``` * `add-logging -o, --output` Using the option `output` followed by the output file path and the input file path, the program will be executed as usual, that is to say, will add a log message into the function and write the result in the output file. ```console add-logging --output output/output.js input/input1.js Output in file 'output/output.js' ``` ## **Contributing**<a name="id5"></a> 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.