JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 222
  • Score
    100M100P100Q92408F
  • License MIT

Similiar to console.time() but returns readable elapsed time e.g Label: 1 hour 20 minutes 10.3 seconds

Package Exports

  • elapsed-time-logger

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (elapsed-time-logger) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Elapsed time logger

Similiar to console.time() & console.timeEnd() but returns formatted elapsed time custom label: 4 hours 10 minutes 23.5 seconds or if less then a second: 540ms

CircleCI Coveralls github npm David npm bundle size NPM

package have only one dependency

Install

$ npm i elapsed-time-logger

Usage

const elapsed = require("elapsed-time-logger");
// chalk is't required, added as example to show that you can use colors in output
const chalk = require('chalk');
 
// elapsed is similliar to console.time() & console.timeEnd() 
elapsed.start('label');
elapsed.start('label_id');
setTimeout(()=>{
    elapsed.end('label');//output: label 801ms
    elapsed.end('label_id', 'Text that goes here will override label on output');
    // output: Text that goes here will override label on output 801ms
}, 800);
// if paramter label is not provided, start() will return an instance 
const elapsedTimer = elapsed.start();
const elapsedTimer2 = elapsed.start();
setTimeout(()=>{
    elapsedTimer2.end(chalk.green('you can use colors here, try chalk or colors packages:'));
    // output: you can use colors here, try chalk or colors packages: 806ms
    const time = elapsedTimer.get();//return 806ms
    console.log(time);
    elapsedTimer.end('finished:');// output: finished: 806ms
}, 800);