Files
picoclaw/pkg/channels/qq/botgo_logger.go
T
美電球 828971d549 Feat/qq local file upload (#1722)
* feat(qq): support media uploads and inbound attachments

* docs(qq): document media size limit settings

* chore(web): add QQ media size limit hints

* fix(qq): demote botgo heartbeat logs

* style(qq): fix lint issues
2026-03-19 16:27:34 +08:00

42 lines
936 B
Go

package qq
import (
"fmt"
"strings"
"github.com/sipeed/picoclaw/pkg/logger"
)
// botGoLogger preserves useful SDK info logs while demoting noisy heartbeat
// traffic to DEBUG so long-running QQ sessions do not spam the console.
type botGoLogger struct {
*logger.Logger
}
func newBotGoLogger(component string) *botGoLogger {
return &botGoLogger{Logger: logger.NewLogger(component)}
}
func (b *botGoLogger) Info(v ...any) {
message := fmt.Sprint(v...)
if shouldDemoteBotGoInfo(message) {
b.Logger.Debug(message)
return
}
b.Logger.Info(message)
}
func (b *botGoLogger) Infof(format string, v ...any) {
message := fmt.Sprintf(format, v...)
if shouldDemoteBotGoInfo(message) {
b.Logger.Debug(message)
return
}
b.Logger.Info(message)
}
func shouldDemoteBotGoInfo(message string) bool {
return strings.Contains(message, " write Heartbeat message") ||
strings.Contains(message, " receive HeartbeatAck message")
}