Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

log-timestamp

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

log-timestamp

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

  • 0.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
58K
decreased by-4.5%
Maintainers
1
Weekly downloads
 
Created
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

Package last updated on 22 Feb 2019

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc