Skip to content
Jan 25 10

node_debug – A debugging console over HTTP

I’d also like to use my blog to write about a few of my personal projects. Many of these aren’t very useful and very few actually reach any usable state, however I feel node_debug is actually something quite useful.

Before reading this post you should probably know what node.js is.

node_debug allows you to evaluate statements and view their result (much like a REPL) from your favourite browser (assuming your favourite browser isn’t IE). It also allows you to browse objects if the result of your statement is an object, for example the global object in node is process so executing process; will return a browsable tree structure of the global scope.

Additionally it exports a log function that allows you to asynchronously output to any active console, for example setTimeout(function () { debug.log("Hello") }, 5000); will output Hello to any open consoles after 5 seconds, allowing useful debug output when using asynchronous functions.

To get started using node_debug you need to have a server running node, and to grab the latest node_debug from github. There is an example.js included to show how you would include it in your own scripts, the idea being you can simply include this in your own project in order to easily debug issues.

Future features I would like to add include:

  • A debug.scope object that allows you to import other objects into the debuggers scope (currently only the global scope is available which can cause confusion due to closures in JavaScript hiding a lot of variables from the debugger).
  • debug.error/warn/info functions in line with the browser console object provided by firebug.
  • Detect disconnection from node and attempt reconnection.
  • Caching of asynchronous messages that can be shown when connecting to the console, in order to log things without having an active browser window all the time.

Node.js

So, the point of this blog is for me to post about things that interest me, this seems like a pretty obvious start.

Node.js is “Evented I/O for V8 javascript” this means you can perform I/O (read files, send across the internet etc) in an extremely efficient way, and write your code in JavaScript (something I find very attractive). I am currently using this for a number of projects including Ircster (more posts on this later).

Tags

I have a blog

I often feel I should have somewhere on the internet to post interesting site I come across, and to share my ideas/projects.

So here it is, a blog, hopefully there will be more content here in the future.