Skip to content

Commit

Permalink
优化
Browse files Browse the repository at this point in the history
  • Loading branch information
injoyai committed Jan 4, 2024
1 parent 1c8fad8 commit 32c19ed
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 3 deletions.
4 changes: 2 additions & 2 deletions io_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
40 changes: 39 additions & 1 deletion io_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ type Server struct {
closeTime time.Time //关闭时间
}

//================================Nature================================
//================================Logger================================

func (this *Server) Debug(b ...bool) {
this.Logger.Debug(b...)
Expand All @@ -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
}
Expand Down

0 comments on commit 32c19ed

Please sign in to comment.