Introducing NodeJS-Dashboard
formidable.com
formidable.com
It doesn't work in combination with nodemon or babel-watch (yet), but the code looks very clean & simple so I assume it'll be an easy update.
If you're looking for more granular reporting & monitoring I can heartily recommend pm2's web dashes [https://github.com/Unitech/pm2]. There are also terminal dashes around like pm2-gui [https://www.npmjs.com/package/pm2-gui].
Nice (and clean) work @formidable.
Then, if you have 800 requests per second, reading logs in this way will not be very valuable.
Best way I have found to manage logs is:
- give requests a unique id. use that id when logging anything related to that request.
- have logs in unformatted json format for size. e.g: use bunyan to save them, use bunyan-cli or jq to read them.
- use unix tools like grep, sort, uniq, wc, etc. to find things...
- you can also feed your logs to elasticsearch/kibana or another aggregator. e.g: logio.org.
Again, jq is very useful processing json. it can help you query logs and find what you need, and format results in any arbitrary way. Make your logs queryable, don't save formatted logs. you will make your life difficult in this way.
Long, unreadable stack traces are still an issue though. pretty-error[2] helps.
[1] https://github.com/FormidableLabs/webpack-dashboard [2] https://npmjs.org/package/pretty-error
=[
Give it a whirl. If it breaks something, disable it (takes one line), and open an issue :)
1) Having to call `cont` at the beginning rather than the debugger stopping at the actual place where the `debugger` line is placed.
2) Having to call `repl` in order to start printing things
3) After calling `repl`, not being able to get back to the mode where you can go to the next line and jump into functions.
4) If jumping into an express.js route, inspecting the request sometimes just results in the message "no frames".
Python's "baked in" command line debugger that you get via `import pdb; pdb.set_trace()` is awesome for this kind of quick and dirty ssh debugging so if you're looking for inspiration on how node's command line debugger should work, check it out. I always miss python's pdb when working with JS or PHP or... anything else.
When working in ruby, check out binding.pry
2) Because then I need another browser window open and that takes up more screen real estate than a terminal
3) Because my browser background is white and reading code on it is less pleasant
4) Because then the place where I say "run these backend tests" and the place where I pop into the debugger are different.
just run node with --inspect (and optionally --debug-brk) and hit the url that it returns with Chrome.
Works beautifully.
Albeit rare in normal JS because it seems most things are fatal when they break, lots of libraries use it.