Socket
Socket
Sign inDemoInstall

log-timestamp

Package Overview
Dependencies
1
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    log-timestamp

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


Version published
Weekly downloads
74K
increased by2.52%
Maintainers
1
Install size
6.80 kB
Created
Weekly downloads
 

Readme

Source

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"

Also you can specify a custom prefix string

require('log-timestamp')('#WHATEVER');
console.log('hello world');

yields

#WHATEVER [2012-08-23T20:08:37.000Z] hello world

Install

npm install log-timestamp

Tests

npm test

License

MIT License

Keywords

FAQs

Last updated on 22 Feb 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc