weixin_39728213
weixin_39728213
2021-01-09 11:03

Debugging methods

I typically use node-inspector for debugging my node apps: https://github.com/dannycoates/node-inspector

However, when starting a socketstream server I can't pass in a --debug param like a normally do to enable debugging. Can this be added or are there alternative methods for debugging?

该提问来源于开源项目:socketstream/socketstream

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

6条回答

  • weixin_39861669 weixin_39861669 4月前

    Hi Jonathan

    I've not used node-inspector myself but I've heard really good things about it - so I'm keen to support if it's an easy change.

    I'll add it to the list of things to look at. If anyone wants to take a stab at this and submit a pull request I'd be happy to merge it in.

    Owen

    点赞 评论 复制链接分享
  • weixin_39760065 weixin_39760065 4月前

    I was able to hack this in pretty easily by adding it to bin/socketstream... obviously not a long term solution, but I can report that node-inspector with '--debug' works fine. For some reason '--debug-brk' behaved the same as '--debug', but I didn't need it enough to press the issue further.

    My idea for a permanent solution is to use child_process::spawn, and add debug flags if signaled by the cli. This could work well with some kind of auto-restart for modified server source or watchdog process, but I can't commit to doing this right now.

    点赞 评论 复制链接分享
  • weixin_39861669 weixin_39861669 4月前

    Great! Thanks Harlan.

    I've put it on the list for 0.2.0 which makes use of child_processes and auto-restarts when the server code changes.

    点赞 评论 复制链接分享
  • weixin_39776298 weixin_39776298 4月前

    Hi harlanji,

    do you have a fork of the code for this? It would be nice to add it as an option for now.

    点赞 评论 复制链接分享
  • weixin_39861669 weixin_39861669 4月前

    Hi all. Support for debugging is coming in the next 0.2 beta later this week.

    点赞 评论 复制链接分享
  • weixin_39861669 weixin_39861669 4月前

    SocketStream 0.2 beta 2 now supports the Node debugger. Just type debug before the command you wish to run. E.g.:

    
    `socketstream debug server`
    
    点赞 评论 复制链接分享

相关推荐