Home
Sign Up
Sign In
Advertisement
V2EX
›
Node.js
有可能在 node 中调用一个 function,但控制 function 的输出流(console.log)吗?
vevlins
·
Mar 3, 2020
· 4003 views
This topic created in 2445 days ago, the information mentioned may be changed or developed.
我要调用另外一个包,这个包有个函数内部有 console.log 。
只知道调系统命令时可以控制 stdout,node 中有办法做到吗?
Node
log
console
function
3 replies
•
2020-03-11 21:08:03 +08:00
Buges
Mar 3, 2020 via Android
1
直接 override console.log 函数不行吗?
zivyou
Mar 3, 2020
2
1l 标准答案
himself65
Mar 11, 2020
3
```js
const fn = console.log
console.log = () => {}
require('xxx.js')
console.log = fn
```
About
·
Help
·
Advertise
·
Blog
·
API
·
FAQ
·
Privacy
·
Solana
·
1129 Online
Highest 6679
·
Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 26ms ·
UTC 23:25
·
PVG 07:25
·
LAX 15:25
·
JFK 18:25
♥ Do have faith in what you're doing.
❯