log-prefix

0.1.1 • Public • Published

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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.1.1
    75,876
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.1.1
    75,876
  • 0.1.0
    3
  • 0.0.0
    791

Package Sidebar

Install

npm i log-prefix

Weekly Downloads

76,670

Version

0.1.1

License

none

Unpacked Size

2.32 kB

Total Files

5

Last publish

Collaborators

  • bahamas10