Node.js 带有日志记录的nodejs交互控制台
我有一个nodeJS应用程序,目前可以在各种事件和类似性质的事情中打印到控制台 我希望维护日志记录功能,同时让用户能够发送输入和命令。 有点像这样:Node.js 带有日志记录的nodejs交互控制台,node.js,Node.js,我有一个nodeJS应用程序,目前可以在各种事件和类似性质的事情中打印到控制台 我希望维护日志记录功能,同时让用户能够发送输入和命令。 有点像这样: Some logs Some other logs Even more logging an unholy amount of gibberish /\ Prints on this line and shifts the other lines up /\ > prompt 我知道您可以以同步方式获取用户输入,程序将等待用户输入提交,但是
Some logs
Some other logs
Even more logging
an unholy amount of gibberish
/\ Prints on this line and shifts the other lines up /\
> prompt
我知道您可以以同步方式获取用户输入,程序将等待用户输入提交,但是否可以这样做?以下是两种可能的选择: 提示 一个易于使用的库来生成提示 readline 如果您想构建自己的代码,可以手动读取输入
如果已经回答,请提前道歉;我已经找了好几个星期了,还没有找到像这样的东西,所以我很好奇这是否可能。非常感谢。