Simple, colorful javascript debugging on demand
Append ?jsbug=true to url in order to enable logging through jsbug within your browser console. And simply add ?jsbug=false to disable it. Jsbug is enabled/disabled through localstorage and will not perform anything if not enabled. It´s incredibly lightweight and do not require any dependencies.
Try it 👈
👉Install jsbug
npm install --save jsbug
Make it a part of the project
// Require itvar debug = ; // Or import it
Usage
Basic debugging
// Print "♢ Clicked a button" using blue color;
Changing the color output
// Print "♢ Clicked another button" using a purple color;
Indicate ajax calls (start msg with a pipe)
// Print "| Requesting api" using yellow color;
Indicate success
// Print "* JSON returned" using green color;
Indicate failure
// Print "@ Failure! Unexpected result" using red color;
Indicate failure with grouped, inspectable properties
// Print "@ Failure: Unexpected result" using red color and make response object inspectable;
Screenshots
Sample code
Default result (collapsed)
Expanded result
Support
Most modern browsers. Feel free to contribute!