控制台调试日志优化

This commit is contained in:
XiaoZhuo
2023-10-03 20:21:13 +08:00
parent 6800b44e49
commit 3f1d86975b
2 changed files with 6 additions and 4 deletions

View File

@@ -167,6 +167,7 @@
// 只有一个基本信道, 用于交换和调度信息
clientList.setChannel('base', {
onopen: async event => {
console.group('')
console.log('打开信道', event.target.label)
// 要求对方发送音乐列表
clientList.send('base', JSON.stringify({ type: 'get_music_list' }))
@@ -186,9 +187,7 @@
console.log(client.name, '发来音乐列表:', `x${JSON.parse(event.data).list.length}`)
console.log('将列表保存到本机记录:', client)
client.musicList = list
console.group('添加音乐')
client.musicList.forEach(music => musicList.add(music))
console.groupEnd('添加音乐')
return
}
if (type === 'get_music_data') {
@@ -221,9 +220,11 @@
console.log('未知类型:', type)
},
onclose: event => {
console.groupEnd('')
console.log('关闭信道', event.target.label)
},
onerror: error => {
console.groupEnd('')
console.log('信道错误', error)
}
})