提交 de17e632 编写于 作者: fxy060608's avatar fxy060608

fix(h5): format server urls

上级 300132c8
import { Formatter } from '../logs/format'
const SIGNAL_H5_NETWORK = ' > Network:'
const networkLogs: string[] = []
export const h5ServeFormatter: Formatter = {
test(msg) {
return msg.includes(' > Local:') || msg.includes(' > Network:')
return msg.includes(SIGNAL_H5_NETWORK)
},
format(msg) {
if (msg.includes(SIGNAL_H5_NETWORK)) {
networkLogs.push(msg)
process.nextTick(() => {
// 延迟打印所有 network,仅最后一个 network 替换 > 为 -,通知 hbx
const len = networkLogs.length - 1
networkLogs[len] = networkLogs[len].replace('>', '-')
console.log(networkLogs.join('\n'))
networkLogs.length = 0
})
return ''
}
return msg.replace('>', '-')
},
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册