nanodebug

0.0.0 • Public • Published

nanodebug

A tiny, zero overhead debugging utility.

Installation

npm install nanodebug

Usage

By default, nanodebug is completely noop:

const debug = require('nanodebug')()

// Does nothing!
debug('You encountered a %s!', '🐛')

// Also does nothing!
debug(() => { debug('It accepts functions as well') })

// This... does nothing!
await debug(async () => { debug('They can even be async!') })

Go ahead and put some debugs in your code and enable nanodebug when 🐛 hits the fan:

const debug = require('nanodebug')({ enabled: true })

By default, debug will log to stderr using console.error, which is also why we were able to specify a formatting string in the examples above. To change this, pass a log function in the options:

const debug = require('nanodebug')({ log: console.log.bind(console) })

Now, debug will instead log to stdout using console.log.

License

ISC

/nanodebug/

    Package Sidebar

    Install

    npm i nanodebug

    Weekly Downloads

    0

    Version

    0.0.0

    License

    ISC

    Unpacked Size

    6.16 kB

    Total Files

    6

    Last publish

    Collaborators

    • mafintosh
    • kasperisager