0.0.5 • Published 6 years ago

function-logger v0.0.5

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

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

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! :checkered_flag:

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