From 368acc9995d94b4ab0623a69274ee4a0f3e7fcba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=BD=E8=90=BD?= Date: Wed, 10 Sep 2025 17:56:44 +0800 Subject: [PATCH] chore (log): rename logging methods to *f suffix --- client/log.go | 16 ++++++++-------- main.go | 8 ++++---- utils/log/log.go | 8 ++++---- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/client/log.go b/client/log.go index c51a02f8..720ccd52 100644 --- a/client/log.go +++ b/client/log.go @@ -15,49 +15,49 @@ func (c *QQClient) SetLogger(logger log.Logger) { func (c *QQClient) info(msg string, args ...any) { if c.logger != nil { - c.logger.Info(msg, args...) + c.logger.Infof(msg, args...) } } func (c *QQClient) infoln(msgs ...any) { if c.logger != nil { - c.logger.Info(fmt.Sprint(msgs...)) + c.logger.Infof(fmt.Sprint(msgs...)) } } func (c *QQClient) warning(msg string, args ...any) { if c.logger != nil { - c.logger.Warning(log.Getcaller(msg), args...) + c.logger.Warningf(log.Getcaller(msg), args...) } } func (c *QQClient) warningln(msgs ...any) { if c.logger != nil { - c.logger.Warning(log.Getcaller(fmt.Sprint(msgs...))) + c.logger.Warningf(log.Getcaller(fmt.Sprint(msgs...))) } } func (c *QQClient) error(msg string, args ...any) { if c.logger != nil { - c.logger.Error(log.Getcaller(msg), args...) + c.logger.Errorf(log.Getcaller(msg), args...) } } func (c *QQClient) errorln(msgs ...any) { if c.logger != nil { - c.logger.Error(log.Getcaller(fmt.Sprint(msgs...))) + c.logger.Errorf(log.Getcaller(fmt.Sprint(msgs...))) } } func (c *QQClient) debug(msg string, args ...any) { if c.logger != nil { - c.logger.Debug(log.Getcaller(msg), args...) + c.logger.Debugf(log.Getcaller(msg), args...) } } func (c *QQClient) debugln(msgs ...any) { if c.logger != nil { - c.logger.Debug(log.Getcaller(fmt.Sprint(msgs...))) + c.logger.Debugf(log.Getcaller(fmt.Sprint(msgs...))) } } diff --git a/main.go b/main.go index 93f59d34..8c03faa3 100644 --- a/main.go +++ b/main.go @@ -183,19 +183,19 @@ type protocolLogger struct{} const fromProtocol = "Lgr -> " -func (p protocolLogger) Info(format string, arg ...any) { +func (p protocolLogger) Infof(format string, arg ...any) { logger.Infof(fromProtocol+format, arg...) } -func (p protocolLogger) Warning(format string, arg ...any) { +func (p protocolLogger) Warningf(format string, arg ...any) { logger.Warnf(fromProtocol+format, arg...) } -func (p protocolLogger) Debug(format string, arg ...any) { +func (p protocolLogger) Debugf(format string, arg ...any) { logger.Debugf(fromProtocol+format, arg...) } -func (p protocolLogger) Error(format string, arg ...any) { +func (p protocolLogger) Errorf(format string, arg ...any) { logger.Errorf(fromProtocol+format, arg...) } diff --git a/utils/log/log.go b/utils/log/log.go index 28af51fa..8b6befed 100644 --- a/utils/log/log.go +++ b/utils/log/log.go @@ -6,10 +6,10 @@ import ( ) type Logger interface { - Info(format string, args ...any) - Warning(format string, args ...any) - Error(format string, args ...any) - Debug(format string, args ...any) + Infof(format string, args ...any) + Warningf(format string, args ...any) + Errorf(format string, args ...any) + Debugf(format string, args ...any) Dump(dumped []byte, format string, args ...any) }