Browse Source

Merge pull request #113 from 173xs/173xs-patch-1

修改zlogger的formatHeader
master
刘丹冰 3 years ago
committed by GitHub
parent
commit
b7d51a2cd7
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      zlog/zlogger.go

5
zlog/zlogger.go

@ -97,7 +97,8 @@ func CleanZinxLog(log *ZinxLogger) {
/* /*
制作当条日志数据的 格式头信息 制作当条日志数据的 格式头信息
*/ */
func (log *ZinxLogger) formatHeader(buf *bytes.Buffer, t time.Time, file string, line int, level int) {
func (log *ZinxLogger) formatHeader(t time.Time, file string, line int, level int) {
var buf *bytes.Buffer = &log.buf
//如果当前前缀字符串不为空,那么需要先写前缀 //如果当前前缀字符串不为空,那么需要先写前缀
if log.prefix != "" { if log.prefix != "" {
buf.WriteByte('<') buf.WriteByte('<')
@ -187,7 +188,7 @@ func (log *ZinxLogger) OutPut(level int, s string) error {
//清零buf //清零buf
log.buf.Reset() log.buf.Reset()
//写日志头 //写日志头
log.formatHeader(&log.buf, now, file, line, level)
log.formatHeader(now, file, line, level)
//写日志内容 //写日志内容
log.buf.WriteString(s) log.buf.WriteString(s)
//补充回车 //补充回车

Loading…
Cancel
Save