lazy-debug
Generates app & module names for vision media's debug
Last updated 9 years ago by apihlaja .
MIT · Repository · Original npm · Tarball · package.json
$ npm install lazy-debug 
SYNC missed versions from official npm registry.

lazy-debug

Travis Build Status Appveyor Build status

lazy-debug is a helper for visionmedia´s debug. It generates module identifiers based on __filename, so your debug identifiers reflect the file structure automatically.

console log

Supports

  • Node.js v0.10 and later
  • Windows and Linux
  • Browserify
  • Webpack

Install

npm install --save debug lazy-debug

The module works out of the box in Node.js and Browserify environments.

Webpack

Webpack needs configuration, include these in your webpack.config.js:

config.node = {
  __filename: true, // populates filenames relative to your app root
  fs: "empty"       // include empty "mock" for fs module
}

Usage

Just require it and provide filename:

var debug = require('lazy-debug')(__filename)
debug('ready for logging..')

Debugger identifier will be relative to module root, ie. something like dir:file. File extensions are omitted and file name is omitted if it´s index.

Suffix

Add suffix by providing submoduleName:

var debug = require('lazy-debug')(__filename, {submoduleName: 'sub'})
var debug = require('lazy-debug')(__filename, 'sub')

Debugger identifier will be dir:file:sub.

Prefix

Add prefix by providing packageName:

var debug = require('lazy-debug')(__filename, {packageName: 'my-lib'})
var debug = require('lazy-debug')(__filename, {packageName: true})

Debugger identifier will be my-lib:dir:file. If package name is boolean true, name from package.json is used. That works only in Node.js environment.

Tests

npm test

Tests node.js compability by running vanilla Mocha at first, then Browserify and Webpack builds are tested in PhantomJS using Karma.

License

The MIT License

Current Tags

  • 0.3.0                                ...           latest (8 years ago)

9 Versions

  • 0.3.0                                ...           8 years ago
  • 0.2.1                                ...           8 years ago
  • 0.1.3                                ...           8 years ago
  • 0.1.2                                ...           8 years ago
  • 0.1.1                                ...           8 years ago
  • 0.1.0                                ...           8 years ago
  • 0.0.3                                ...           9 years ago
  • 0.0.2                                ...           9 years ago
  • 0.0.1                                ...           9 years ago
Maintainers (1)
Downloads
Total 10
Today 1
This Week 1
This Month 10
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (2)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE