Skip to content

A very tiny Javascript debugging utility. It's a lite version of debug.

License

Notifications You must be signed in to change notification settings

renzocastro/debug-lite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Debug Lite

A very tiny Javascript debugging utility. It's inspired by debug but for only be used on browsers.

File size

package minified gzipped
debug (browser) 7.67KB 3.05KB
debug-lite 1.37KB 661 bytes

Files was minified using https://closure-compiler.appspot.com/home .

Installation

$ npm install debug-lite

Usage

For browser globals:

  • Using debug-lite.umd.min.js file and use window.debugLite.createDebug function.

For bundlers like Webpack or Browserify:

  • Using as module import { createDebug } from 'debug-lite'

Example

// import { createDebug } from 'debug-lite';
const createDebug = require('debug-lite').createDebug;

const log = createDebug('App');
const logInit = createDebug('App:init');
const logBuild = createDebug('App:build');

function init() {
  logInit('Initializing...');
}

function build() {
  logBuild('Building...');
}

function main () {
  log('app.js file is loaded');

  init();
  build();
}

main();

Open console and try:

localStorage.DEBUG = '*';
location.reload();

Show all messages

You can found a complete example here.

License

MIT

About

A very tiny Javascript debugging utility. It's a lite version of debug.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published