NodeJS Console Object Debug Inspector
Or simply node-codein (longtail for SEO) is supposed to do what Webkit Inspector's Console does. Except this works exclusively with NodeJS.
License & disclaimer
Disclaimer: Said tool is only intended for dicking around, and is thus unsuitable for enterprise-level operations; this program should not be used for reliable remote instrumentation or monitoring, or as a replacement for NodeJS's console system. This program cannot guide missiles out of North Korea.
NodeJS v0.8.0+, Chrome 19.xx.xxxx.xx+, Win XP+
- Download the package, put it somewhere you can find it
- In your script add require("path/to/folder/node-codein")
- Run nodejs
- Start %localappdata%/Google/Chrome/Application/chrome.exe --app=http://localhost:55281
- Make sure you only use Chrome. It might works on something else but going straight with Chrome will save you time.
- Displays objects in tree format, with expand/collapse controls
- Executes arbitrary code
- Wraps the common logging functions: console.log(), console.info(), console.warn() & console.error()
- Wraps unhandled exceptions via process.on('uncaughtException', ...)
- Broadcasts messages to all connected clients
- Reconnects automatically
Visible and hidden features
- enable iScroll (click-drag to scroll/pan)
- theme switcher (dark seems to attract the ladies lol :D)
- YAND.info (Node's API docs)
- Node's twitter
Middle thin bar:
- drag to resize
- double click to hide input area
Bottom row - left:
- hide/show input area
- clear all messages
- automatically expand objects (just first level)
- structure object levels + row highlighter
- input preservation (for spammers)
Bottom row - right:
- expand + collapse every single visible object
- reload (alias for F5)
- duplicate window (opens all the messages in it; uses $.clone() so some controls might be inherited from the parent window)
- saves last 50 command in local storage, use arrow keys to navigate through previous commands
- typing suggestions and autocomplete
- double-click a property name in the message window to insert it
- shit+enter for new lines
- tab key indents
Lots of them. Because I had to took a day off from work to build this, so there's was no time to organize nor bughunt.
- Console log may not pass through every now and again or so. I planned on using EventSource but it wasn't working (maybe buffering instead of flushing, I don't know, can't WireShark locally). So what it does is it keeps connections in a waiting state and when it gets something, it writes and closes those connections. Then clients are supposed to connect back.
- Autocomplete spams your server. Lag is in place and can be tweaked but it'll basically chop-off words when you hit enter.
- iScroll + expand all + ctrl+f to find properties will lock the whole browser; not sure why, don't care much, just disable iScroll if you're using this tecnhique to find properties.
- Autocomplete may not appear after using left / right arrow keys or escape. This is intentional, those 3 keys are GTFO master keys, but if you want the list of suggestions back, type some gibberish and press backspace.
- The whole source code is haywired.
What's wrong about the regular console?
Its overall buffer size, no syntax coloring, hard to use, no direct input, so forth. If you're familar to webkit's "Inspect Element" console tab, you'll see the differences.
Then what's wrong with Eclipse's V8 Debugger?
A debugger is something totally different. Well not really but you still need to set breakpoints, stop executions, scope variables, etc. Plus you have to restart Node to put code in. I can make more excuses if necessary.
Why not just fix node-inspector?
I tried. I first tried to pass back stringified objects and decode them in the local console. The problem was that there was a hardcoded limit of 80 characters beyond which the string turned into "str... (length: 2219)". I'm not sure where this came from but I believe it was built into v8 when it was compiled with Node. I also tried fixing the 0:0:0 (context:scope:handle) but it seemed to pass back blank values no matter what. I didn't had time for that.
Can you help me do X / can you add X / can you fix X?
I'll do everything that doesn't take more than 5 minutes to do. I'm really in a time crisis, but even if I wasn't, I'm highly capitalistic about all my work.
Fork, pull, push, drag, chop, send, fax whatever you want you're free to do it.
Good luck buddy.