Socket
Socket
Sign inDemoInstall

log-prefix

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    log-prefix

Prefix calls to console.log, console.warn, etc with whatever you'd like


Version published
Maintainers
1
Install size
3.21 kB
Created

Readme

Source

log-prefix

Prefix calls to console.log, console.warn, etc with whatever you'd like

Example

console.log('before log-prefix');
require('log-prefix')('==> %s <==');
console.log('after log-prefix');

yields

before log-prefix
==> after log-prefix <==

You can specify a function instead of a string. The function must return a string to be used (good for dynamic values).

require('log-prefix')(function() { return '[' + Date.now() + '] %s' });
console.log('hello %s', 'world');

yields

[1371582989993] hello world

Install

npm install log-prefix

Tests

npm test

License

MIT License

Keywords

FAQs

Last updated on 11 Sep 2018

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