Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 带有日志记录的nodejs交互控制台_Node.js - Fatal编程技术网

Node.js 带有日志记录的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 我知道您可以以同步方式获取用户输入,程序将等待用户输入提交,但是

我有一个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

我知道您可以以同步方式获取用户输入,程序将等待用户输入提交,但是否可以这样做?

以下是两种可能的选择:

提示

一个易于使用的库来生成提示

readline

如果您想构建自己的代码,可以手动读取输入


如果已经回答,请提前道歉;我已经找了好几个星期了,还没有找到像这样的东西,所以我很好奇这是否可能。非常感谢。