🚀 Launch Week Day 4:Introducing the Alert Details Page: A Better Way to Explore Alerts.Learn More →
Socket
Book a DemoInstallSign in
Socket

base-debug

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

base-debug

Plugin for debugging your base application.

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

base-debug NPM version Build Status

Plugin for debugging your base application.

Install

Install with npm:

$ npm i base-debug --save

Usage

To test-drive the plugin, add this to example.js (or just use the examples/example.js file in this project):

var debug = require('base-debug');
var Base = require('base');
var base = new Base();

base.use(debug('foo'));

var one = base.debug('one');
var two = base.debug('two');

one('this is one!');
two('this is two!');

Then, in the command line:

  • run DEBUG=base:* node example
  • then try DEBUG=base:one node example

(See the debug docs for more information about using debug on all platforms.)

Namespace

Inside your plugin, register the debug() plugin, passing the name of your plugin as the "namespace" to use:

// given you have a plugin named `base-foo`
function baseFoo(options) {
  return function(app) {
    app.use(debug('foo'));

    // then call the `app.debug` method
    var debug = app.debug();
    
    // then use it like this:
    debug('yelling abc: %s', 'ABC!');
    debug('yelling xyz: %s', 'XYZ!');
  }
}

When your plugin is registered, like this:

// Add your plugin
var base = new Base();
base.use(baseFoo());

and the DEBUG=base:foo command is used, you should see something like this in the terminal:

base-debug plugin - namespaces

(See the debug docs for more information about using debug on all platforms.)

Sub-namespaces

Optionally use "sub-namespaces":

function baseFoo(options) {
  return function(app) {
    app.use(debug('foo'));
  
    // namespace `foo:one`
    var one = app.debug('one');

    // namespace `foo:two`
    var two = app.debug('two');
    
    // then use it like this:
    one('yelling abc: %s', 'ABC!');
    two('yelling xyz: %s', 'XYZ!');
  }
}

When your plugin is registered, like this:

// Add your plugin
var base = new Base();
base.use(baseFoo());

and the following commands are used:

  • DEBUG=base:foo:*, or
  • DEBUG=base:foo:one, or
  • DEBUG=base:foo:two

You should see something like this in the terminal:

screen shot 2016-01-23 at 9 36 39 am

(See the debug docs for more information about using debug on all platforms.)

You might also be interested in these projects:

  • base: base is the foundation for creating modular, unit testable and highly pluggable node.js applications, starting… more | homepage
  • base-fs: base-methods plugin that adds vinyl-fs methods to your 'base' application for working with the file… more | homepage
  • base-options: Adds a few options methods to base-methods, like option, enable and disable. See the readme… more | homepage
  • base-pipeline: base-methods plugin that adds pipeline and plugin methods for dynamically composing streaming plugin pipelines. | homepage
  • base-plugins: Upgrade's plugin support in base-methods to allow plugins to be called any time after init. | homepage
  • base-tasks: base-methods plugin that provides a very thin wrapper around https://github.com/jonschlinkert/composer for adding task methods to… more | homepage

Running tests

Install dev dependencies:

$ npm i -d && npm test

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Author

Jon Schlinkert

License

Copyright © 2016 Jon Schlinkert Released under the MIT license.

This file was generated by verb on January 23, 2016.

Keywords

base

FAQs

Package last updated on 23 Jan 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts