Skip to content

matthewmueller/debug-timer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

debug-timer

time things. outputs to visionmedia/debug.

Installation

Install with component(1):

$ component install matthewmueller/debug-timer

Install with npm:

$ npm install debug-timer

Example

var timer = require('debug-timer')('timer');
timer('js');
timer('css');

setTimeout(function() {
  timer.end('js')
}, 1000);

setTimeout(function() {
  timer.end('css')
}, 2000);

API

Timer(namespace)

Assign timer to a namespace. In the code this means: require('debug')(namespace).

timer(key)

Start a timer with the given key.

timer.end(key)

End the timer with the given key.

timer.template

Assign a custom template. The first %s is the key, second %s is the elapsed time. Defaults to:

timer.template = %s: %s;

License

MIT

About

time things. outputs to visionmedia/debug

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published