Ajouter temps UTC!
A lightweight, zero-dependencies, asynchronous and fully-tested pure Node.js debugger.
bugbug is a lightweight, zero-dependencies, asynchronous and fully-tested pure Node.js debugger. It writes on process.stderr when the DEBUG environment variable is set and match a specific module's name/pattern and uses a specified/random output color if the terminal allows it.
The aim of this project is to provide a very simple, lightweight, zero-dependency, fast and fully-tested debugger.
npm install bugbug
npm i -S bugbug
ESLint with Airbnb base rules. See Airbnb JavaScript Style Guide.
npm run lint
Mocha and Chai.
npm test
bugbug module exports one function named getDebugger. This function once called will return the debug function related to a specific debugger's name that will allow to debug on stderr.
// first get the getDebugger function
const getDebugger = require('bugbug');
// then get the debug function from a stored or newly created debugger
const debug = getDebugger('my-module', 'red');
// OR faster way to get the debug function
const debug = require('bugbug')('my-module', 'red');
name
<String> The debugger's name. Generally the module's name to debug. Default: debug
color
<String> The debugging color if the terminal allows it. Default: red
for the default debugger or a random
color
red
green
yellow
blue
magenta
cyan
lightRed
lightGreen
lightYellow
lightBlue
lightMagenta
lightCyan
Returns: <Function> Function called debug to finally debug in the name of the related module.
Throws: NO
You can find examples here: docs/examples
const debug = require('bugbug')('my-module', 'red');
debug('debugging');
debug('still debugging');
const debug = require('bugbug')('node-sparkline', 'green');
const options = {
values: [1, 2, 3, 4, 5],
width: 500,
height: 500,
};
debug('everything's fine');
debug('process done');
debug('sparkline generated in SVG format,', 'additional stuff');
debug('options:', options);
const debug = require('bugbug')();
const options = {
values: [1, 2, 3, 4, 5],
width: 500,
height: 500,
};
debug('main debugger is debugging');
debug('in red color if terminal allows it');
debug('options:', options);
DEBUG is used to whether debug a specific module. DEBUG value can be a comma-separated string listing module names to debug or to avoid debugging. Format is: DEBUG=moduleName[,moduleName]
DEBUG=moduleName
will debug moduleName module;DEBUG=moduleName:*
will debug moduleName module and sub modules;DEBUG=-moduleName:*
will disable debugging any moduleName module and sub modules;DEBUG=*
will debug all moduleName module and sub modules plus other modules used in your project if they use bugbug or an equivalent debugger based on process.env.DEBUG value.This project has a Code of Conduct. By interacting with this repository, organization, or community you agree to abide by its terms.
Please take a moment to read our Contributing Guidelines if you haven't yet done so.
Please see our Support page if you have any questions or for any help needed.
For any security concerns or issues, please visit our Security Policy page.
MIT.