在使用Node 10及以上版本时,您应该使用functions.logger.log()
。请参阅:https://firebase.google.com/docs/functions/writing-and-viewing-logs
我可以确认我也遇到了同样的问题,自从更新到Node 10版本后,JSON对象被打印成多行。
目前的解决方案是引入这个依赖:
require('firebase-functions/lib/logger/compat');
就我所知,当我在Firebase Functions上使用NodeJS 8时,我没有看到这种日志记录行为。因此,在Firebase端,某些内容已更改...还请查看此GitHub问题:https://github.com/firebase/firebase-functions/issues/612
console.log
语句应该在在线控制台中输出一个日志。你能展示你的整个代码吗? - ultraGentleconsole.log()
输出数据,也许console.table可以帮助以可读的方式显示数据。 - ROOT