Prepend timestamps to functions like console.log, console.warn, etc
JavaScript
Latest commit c1a091c Jan 14, 2015 @bahamas10 bahamas10 bump
Permalink
Failed to load latest commit information.
tests added tests Jan 14, 2015
.gitignore Initial Commit Aug 23, 2012
README.md Fixed custom function example syntax. Apr 26, 2014
log-timestamp.js Fix the output for Object Jan 14, 2015
package.json bump Jan 14, 2015

README.md

log-timestamp

Prepend timestamps to functions like console.log, console.warn, etc

Example

console.log('Before log-timestamp');
require('log-timestamp');
console.log('After log-timestamp');

yields

Before log-timestamp
[2012-08-23T20:08:32.000Z] After log-timestamp

You can specify a custom function as well

require('log-timestamp')(function() { return 'date="' + new Date().toISOString() + '" message="%s"' });
console.log('hello %s', 'world');

yields

date="2012-08-23T20:08:37.000Z" message="hello world"

Install

npm install log-timestamp

Tests

npm test

License

MIT License