1.3.0 • Published 4 years ago

jobtimer v1.3.0

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

Job Timer

badge semantic-release

Times jobs, allows you to add metadata, and collects the job as a JSON string

Installation

$ npm install jobtimer

Usage

const { startTimedJob, endTimedJob } = require("jobtimer");

// Start a timed job
const start = startTimedJob({ msg: "myjob" });

// Run some long-running job
const result = await longRunningFunction();

// Add result to job
start.result = result;

// Log the results
console.log(endTimedJob(start));
// {"msg":"myjob","result":"myresult","tpt":137}

Note: tpt stands for Total Processing Time.

License

Copyright © 2020 Rob Warner Licensed under the MIT License