2.0.1 • Published 5 years ago
time-saved v2.0.1
Time Saved
Discover how much time is saved from a manual job.
This module calculates how long your application has been running from start to finish, then saves that data to a MongoDB server along with a few other details.
Setup
Create a .env
file in your project root, and provide the following details:
MongoDBServer = '' // 'mongodb://heroku_00000000:A1B2C3@D4E5F6.mlab.com:0000/heroku_00000000'
AppName = '' // 'My Useful App'
AverageTaskTime = 0000 // Time, in milliseconds the task is expected to run without the use of an app, as a Number.
Usage
const timeSaved = require('time-saved');
// Starts the timer.
timeSaved.start();
// Ends the timer.
timeSaved.end();
// Updates MongoDB with values for retrieval later.
timeSaved.update();
Output
{
"_id": {
"$oid": "5c73997dfdsfdsccbe39f17a"
},
"timeStart": 1551079805658,
"timeEnd": 1551079805659,
"app": "My Useful App",
"timeAverage": 4000,
"__v": 0
}