dk

A very simple but extremely useful collection of tools for quickly debugging your node projects.

npm install dk
2 downloads in the last week
8 downloads in the last month

dk - Debug Kit

A very simple but extremely useful collection of tools for quickly debugging your node projects. Currently a work in progress and I plan to add more to it as I continue learning node.

Install

$ npm install dk

Example

This module is easy to get up and running with:

var dk = require('dk');

dk.log(undefined, null, false, true, 1, 1.5, "str", ["arr1", "arr2"], {key: "value"}, function() {});
----------------------------[Log with 10 args]----------------------------

  Argument1 (undefined):
  undefined

  Argument2 (null):
  null

  Argument3 (boolean false):
  false

  Argument4 (boolean true):
  true

  Argument5 (number):
  1

  Argument6 (float):
  1.5

  Argument7 (string):
  'str'

  Argument8 (array):
  [ 'arr1', 'arr2' ]

  Argument9 (object):
  { key: 'value' }

  Argument10 (function):
  function () {}

  Stack:
    at Context.<anonymous> (/home/chris/dev/nodejs/projects/npm-dk/test/dk.js:14:10)
    at Test.Runnable.run (/home/chris/dev/nodejs/projects/npm-dk/node_modules/mocha/lib/runnable.js:196:15)
    at Runner.runTest (/home/chris/dev/nodejs/projects/npm-dk/node_modules/mocha/lib/runner.js:343:10)
    at Runner.runTests.next (/home/chris/dev/nodejs/projects/npm-dk/node_modules/mocha/lib/runner.js:389:12)
    at next (/home/chris/dev/nodejs/projects/npm-dk/node_modules/mocha/lib/runner.js:269:14)
    at Runner.hooks (/home/chris/dev/nodejs/projects/npm-dk/node_modules/mocha/lib/runner.js:278:7)
    at next (/home/chris/dev/nodejs/projects/npm-dk/node_modules/mocha/lib/runner.js:226:23)
    at Runner.hook (/home/chris/dev/nodejs/projects/npm-dk/node_modules/mocha/lib/runner.js:246:5)
    at process.startup.processNextTick.process._tickCallback (node.js:244:9)

Global log

If you are like me and the entire purpose that you use this module for is quick prints of data structures and such during development, then you might find a tiny global object useful. Globals can be very evil but I think it's a good trade off here and speeds up my development time a bit, I personally do something like this:

app.configure('development', function () {
  GLOBAL.l = require('dk').log;

  // now I can do...
  l('my log message');

  // the return value of l is the func itself
  l('my log message')('another message');

});
var dk = require('dk');

dk.log(undefined, null, false, true, 1, 1.5, "str", ["arr1", "arr2"], {key: "value"}, function() {});

BUGS

When you find issues, please report them:

npm loves you