Skip to content

Commit

Permalink
feat: improve logging by adding fields to variadic funcs (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
revitteth authored Mar 10, 2022
1 parent 53b6859 commit 62ca4b0
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,58 +73,58 @@ func (z *Zaplog) With(fields ...zapcore.Field) *Zaplog {
return &Zaplog{z.Logger.With(fields...), z.redactor}
}

func (z *Zaplog) InfoRedact(s string) *Zaplog {
z.Info(z.Redact(s))
func (z *Zaplog) InfoRedact(s string, fields ...zapcore.Field) *Zaplog {
z.Info(z.Redact(s), fields...)
return z
}

func (z *Zaplog) DebugRedact(s string) *Zaplog {
z.Debug(z.Redact(s))
func (z *Zaplog) DebugRedact(s string, fields ...zapcore.Field) *Zaplog {
z.Debug(z.Redact(s), fields...)
return z
}

func (z *Zaplog) WarnRedact(s string) *Zaplog {
z.Warn(z.Redact(s))
func (z *Zaplog) WarnRedact(s string, fields ...zapcore.Field) *Zaplog {
z.Warn(z.Redact(s), fields...)
return z
}

func (z *Zaplog) ErrorRedact(s string) *Zaplog {
z.Error(z.Redact(s))
func (z *Zaplog) ErrorRedact(s string, fields ...zapcore.Field) *Zaplog {
z.Error(z.Redact(s), fields...)
return z
}

func (z *Zaplog) PanicRedact(s string) *Zaplog {
z.Panic(z.Redact(s))
func (z *Zaplog) PanicRedact(s string, fields ...zapcore.Field) *Zaplog {
z.Panic(z.Redact(s), fields...)
return z
}

func (z *Zaplog) FatalRedact(s string) *Zaplog {
z.Fatal(z.Redact(s))
func (z *Zaplog) FatalRedact(s string, fields ...zapcore.Field) *Zaplog {
z.Fatal(z.Redact(s), fields...)
return z
}

func (z *Zaplog) InfoErr(e error) *Zaplog {
z.Logger.Info(e.Error())
func (z *Zaplog) InfoErr(e error, fields ...zapcore.Field) *Zaplog {
z.Logger.Info(e.Error(), fields...)
return z
}

func (z *Zaplog) DebugErr(e error) *Zaplog {
z.Logger.Debug(e.Error())
func (z *Zaplog) DebugErr(e error, fields ...zapcore.Field) *Zaplog {
z.Logger.Debug(e.Error(), fields...)
return z
}

func (z *Zaplog) WarnErr(e error) *Zaplog {
z.Logger.Warn(e.Error())
func (z *Zaplog) WarnErr(e error, fields ...zapcore.Field) *Zaplog {
z.Logger.Warn(e.Error(), fields...)
return z
}

func (z *Zaplog) ErrorErr(e error) *Zaplog {
z.Logger.Error(e.Error())
func (z *Zaplog) ErrorErr(e error, fields ...zapcore.Field) *Zaplog {
z.Logger.Error(e.Error(), fields...)
return z
}

func (z *Zaplog) PanicErr(e error) *Zaplog {
z.Logger.Panic(e.Error())
func (z *Zaplog) PanicErr(e error, fields ...zapcore.Field) *Zaplog {
z.Logger.Panic(e.Error(), fields...)
return z
}

Expand Down

0 comments on commit 62ca4b0

Please sign in to comment.