Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Prefix calls to console.log, console.warn, etc with whatever you'd like
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
tests
.gitignore
README.md
log-prefix.js
package.json

README.md

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

Something went wrong with that request. Please try again.