From 32c19ed94aaa32b43a2c8ad517e758188a755fb3 Mon Sep 17 00:00:00 2001 From: injoy <1113655791@qq.com> Date: Thu, 4 Jan 2024 15:10:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- io_client.go | 4 ++-- io_server.go | 40 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 41 insertions(+), 3 deletions(-) diff --git a/io_client.go b/io_client.go index 2adae7f..2246256 100644 --- a/io_client.go +++ b/io_client.go @@ -270,12 +270,12 @@ func (this *Client) SetPrintWithAll() *Client { return this.SetLevel(LevelAll) } -// SetPrintWithBase 设置打印ASCII,基础信息 +// SetPrintWithBase 设置打印基础信息 func (this *Client) SetPrintWithBase() *Client { return this.SetLevel(LevelInfo) } -// SetPrintWithErr 设置打印ASCII,错误信息 +// SetPrintWithErr 设置打印错误信息 func (this *Client) SetPrintWithErr() *Client { return this.SetLevel(LevelError) } diff --git a/io_server.go b/io_server.go index 910f35d..2ebf3a3 100644 --- a/io_server.go +++ b/io_server.go @@ -66,7 +66,7 @@ type Server struct { closeTime time.Time //关闭时间 } -//================================Nature================================ +//================================Logger================================ func (this *Server) Debug(b ...bool) { this.Logger.Debug(b...) @@ -82,6 +82,44 @@ func (this *Server) SetLogger(logger Logger) *Server { return this } +func (this *Server) SetPrintWithUTF8() *Server { + this.Logger.SetPrintWithUTF8() + this.ICloser.Logger.SetPrintWithUTF8() + this.ClientManage.Logger.SetPrintWithUTF8() + return this +} + +func (this *Server) SetPrintWithHEX() *Server { + this.Logger.SetPrintWithHEX() + this.ICloser.Logger.SetPrintWithHEX() + this.ClientManage.Logger.SetPrintWithHEX() + return this +} + +func (this *Server) SetLevel(level Level) *Server { + this.Logger.SetLevel(level) + this.ICloser.Logger.SetLevel(level) + this.ClientManage.Logger.SetLevel(level) + return this +} + +// SetPrintWithAll 设置打印等级为全部 +func (this *Server) SetPrintWithAll() *Server { + return this.SetLevel(LevelAll) +} + +// SetPrintWithBase 设置打印ASCII,基础信息 +func (this *Server) SetPrintWithBase() *Server { + return this.SetLevel(LevelInfo) +} + +// SetPrintWithErr 设置打印错误信息 +func (this *Server) SetPrintWithErr() *Server { + return this.SetLevel(LevelError) +} + +//================================Nature================================ + func (this *Server) Tag() *maps.Safe { return this.tag }