function-logger

0.0.5 • Public • Published

function-logger

Logging of the input and output arguments of the function on each call.

Example

code

function doJob(job) {
  console.log('I did the job: ' + job);
  
  return 'job report: ' + job;
}
 
// doJob('run')
functionLogger(doJob)('run');

output in console

output

Install

npm install function-logger --save-dev

You can set globally, to be used in all their projects without having to install each.

Usage

Wrap the function for which you want to watch. And yet! 🏁

import functionLogger from 'function-logger';
 
// foo('bar')
functionLogger(foo)('bar')

Usage for CodePen and JSBin as UMD module

in html area

<script src="https://unpkg.com/function-logger@latest/build/umd/index.js"></script>

in js area use functionLogger from global scope

Contributing

Got ideas on how to make this better? Open an issue!

License

MIT

Package Sidebar

Install

npm i function-logger

Weekly Downloads

7

Version

0.0.5

License

MIT

Unpacked Size

9.63 kB

Total Files

7

Last publish

Collaborators

  • itwillwork