From 206796c05dd9054e43b12928e62e7379e882df94 Mon Sep 17 00:00:00 2001 From: Keuin Date: Sat, 29 Jul 2023 12:13:00 +0800 Subject: Log raw danmaku message if decoding is failed --- recording/watcher.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/recording/watcher.go b/recording/watcher.go index 0e4b459..f06b405 100644 --- a/recording/watcher.go +++ b/recording/watcher.go @@ -2,6 +2,7 @@ package recording import ( "context" + "encoding/base64" "encoding/json" errs "github.com/keuin/slbr/bilibili/errors" "github.com/keuin/slbr/danmaku" @@ -174,7 +175,8 @@ func watch( } dmm, err := dmmsg.ParseDanmakuMessage(raw) if err != nil { - logger.Error("Cannot parse danmaku message JSON: %v", err) + logger.Error("Cannot parse danmaku message JSON: %v, raw data (base64 encoded): %v", + err, base64.StdEncoding.EncodeToString(msg.Body)) continue } logger.Info("Danmaku: %v", dmm.String()) -- cgit v1.2.3