简体   繁体   English

如何使用node.js中的console.log写入窗口的不同部分?

[英]How to write to different sections of a window using console.log in node.js?

I'm wondering if it's possible to write to different sections/portions of a node.js terminal window when I log output. 我想知道是否可以在记录输出时写入到node.js终端窗口的不同部分/部分。 Kind of like divs with html. 有点像带有div的div。

So can I for example split the window to two columns and console.log things in one side, and console.log things to the other side? 这样我就可以例如窗口拆分到两列console.log在一边的东西, console.log事情的另一面? (without using a library like tmux). (不使用tmux之类的库)。

Console.table would have been a good bet, but it is not yet implemented. Console.table本来是一个不错的选择,但尚未实现。

Console.printer shows more promise, but is reliant on the implementation method used to do the formatting. Console.printer显示出更多的希望,但依赖于进行格式化的实现方法。 If you scroll down to the example, your best option might be to use something like this example to define your own formatter which writes to either stdout or stderr. 如果向下滚动至示例,则最佳选择可能是使用类似于此示例的内容来定义自己的格式化程序,该格式化程序将写入stdout或stderr。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM