Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    log-prefixpublic

    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

    none

    install

    npm i log-prefix

    Downloadsweekly downloads

    2,738

    version

    0.0.0

    license

    none

    repository

    githubgithub

    last publish

    collaborators

    • avatar