upgrade logrus, add logger.Trace support

Signed-off-by: Adphi <philippe.adrien.nousse@gmail.com>
This commit is contained in:
Adphi 2022-12-22 10:27:33 +01:00
parent ef9a12d89e
commit 926af303e8
Signed by: adphi
GPG Key ID: 46BE4062DB2397FF
3 changed files with 22 additions and 3 deletions

2
go.mod
View File

@ -27,7 +27,7 @@ require (
github.com/planetscale/vtprotobuf v0.2.0 github.com/planetscale/vtprotobuf v0.2.0
github.com/prometheus/client_golang v1.11.0 github.com/prometheus/client_golang v1.11.0
github.com/rs/cors v1.7.0 github.com/rs/cors v1.7.0
github.com/sirupsen/logrus v1.8.1 github.com/sirupsen/logrus v1.9.0
github.com/soheilhy/cmux v0.1.5 github.com/soheilhy/cmux v0.1.5
github.com/spf13/cobra v1.3.0 github.com/spf13/cobra v1.3.0
github.com/spf13/pflag v1.0.5 github.com/spf13/pflag v1.0.5

4
go.sum
View File

@ -609,6 +609,8 @@ github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrf
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
@ -931,6 +933,8 @@ golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211205182925-97ca703d548d h1:FjkYO/PPp4Wi0EAUOVLxePm7qVW4r4ctbWpURyuOD0E= golang.org/x/sys v0.0.0-20211205182925-97ca703d548d h1:FjkYO/PPp4Wi0EAUOVLxePm7qVW4r4ctbWpURyuOD0E=
golang.org/x/sys v0.0.0-20211205182925-97ca703d548d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211205182925-97ca703d548d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 h1:0A+M6Uqn+Eje4kHMK80dtF3JCXC4ykBgQG4Fe06QRhQ=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=

View File

@ -21,7 +21,7 @@ func New() Logger {
return &logger{fl: logrus.New()} return &logger{fl: logrus.New()}
} }
func FromLogrus(fl logrus.FieldLogger) Logger { func FromLogrus(fl logrus.Ext1FieldLogger) Logger {
return &logger{fl: fl} return &logger{fl: fl}
} }
@ -35,6 +35,7 @@ type Logger interface {
SetOutput(w io.Writer) Logger SetOutput(w io.Writer) Logger
Tracef(format string, args ...interface{})
Debugf(format string, args ...interface{}) Debugf(format string, args ...interface{})
Infof(format string, args ...interface{}) Infof(format string, args ...interface{})
Printf(format string, args ...interface{}) Printf(format string, args ...interface{})
@ -44,6 +45,7 @@ type Logger interface {
Fatalf(format string, args ...interface{}) Fatalf(format string, args ...interface{})
Panicf(format string, args ...interface{}) Panicf(format string, args ...interface{})
Trace(args ...interface{})
Debug(args ...interface{}) Debug(args ...interface{})
Info(args ...interface{}) Info(args ...interface{})
Print(args ...interface{}) Print(args ...interface{})
@ -53,6 +55,7 @@ type Logger interface {
Fatal(args ...interface{}) Fatal(args ...interface{})
Panic(args ...interface{}) Panic(args ...interface{})
Traceln(args ...interface{})
Debugln(args ...interface{}) Debugln(args ...interface{})
Infoln(args ...interface{}) Infoln(args ...interface{})
Println(args ...interface{}) Println(args ...interface{})
@ -68,7 +71,11 @@ type Logger interface {
} }
type logger struct { type logger struct {
fl logrus.FieldLogger fl logrus.Ext1FieldLogger
}
func (l *logger) Tracef(format string, args ...interface{}) {
l.fl.Tracef(format, args...)
} }
func (l *logger) Debugf(format string, args ...interface{}) { func (l *logger) Debugf(format string, args ...interface{}) {
@ -103,6 +110,10 @@ func (l *logger) Panicf(format string, args ...interface{}) {
l.fl.Panicf(format, args...) l.fl.Panicf(format, args...)
} }
func (l *logger) Trace(args ...interface{}) {
l.fl.Trace(args...)
}
func (l *logger) Debug(args ...interface{}) { func (l *logger) Debug(args ...interface{}) {
l.fl.Debug(args...) l.fl.Debug(args...)
} }
@ -135,6 +146,10 @@ func (l *logger) Panic(args ...interface{}) {
l.fl.Panic(args...) l.fl.Panic(args...)
} }
func (l *logger) Traceln(args ...interface{}) {
l.fl.Traceln(args...)
}
func (l *logger) Debugln(args ...interface{}) { func (l *logger) Debugln(args ...interface{}) {
l.fl.Debugln(args...) l.fl.Debugln(args...)
} }