update logrus
This commit is contained in:
parent
7cfdb8bb91
commit
7b3cd836fd
2 changed files with 4 additions and 6 deletions
4
go.mod
4
go.mod
|
|
@ -24,9 +24,7 @@ require (
|
||||||
github.com/mssola/user_agent v0.5.1
|
github.com/mssola/user_agent v0.5.1
|
||||||
github.com/olekukonko/tablewriter v0.0.4 // indirect
|
github.com/olekukonko/tablewriter v0.0.4 // indirect
|
||||||
github.com/onsi/gomega v1.4.2 // indirect
|
github.com/onsi/gomega v1.4.2 // indirect
|
||||||
github.com/pelletier/go-toml v1.6.0 // indirect
|
github.com/sirupsen/logrus v1.8.1
|
||||||
github.com/sirupsen/logrus v1.4.2
|
|
||||||
github.com/spf13/afero v1.2.2 // indirect
|
|
||||||
github.com/spf13/cast v1.3.1 // indirect
|
github.com/spf13/cast v1.3.1 // indirect
|
||||||
github.com/spf13/cobra v0.0.6
|
github.com/spf13/cobra v0.0.6
|
||||||
github.com/spf13/jwalterweatherman v1.1.0 // indirect
|
github.com/spf13/jwalterweatherman v1.1.0 // indirect
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/go-chi/chi/middleware"
|
"github.com/go-chi/chi/v5/middleware"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
)
|
)
|
||||||
|
|
@ -76,7 +76,7 @@ func (l *StructuredLogger) NewLogEntry(r *http.Request) middleware.LogEntry {
|
||||||
logFields["user_agent"] = r.UserAgent()
|
logFields["user_agent"] = r.UserAgent()
|
||||||
|
|
||||||
logFields["uri"] = fmt.Sprintf("%s://%s%s", scheme, r.Host, r.RequestURI)
|
logFields["uri"] = fmt.Sprintf("%s://%s%s", scheme, r.Host, r.RequestURI)
|
||||||
logFields["uri"] = fmt.Sprintf("%s", r.RequestURI)
|
logFields["uri"] = r.RequestURI
|
||||||
|
|
||||||
entry.Logger = entry.Logger.WithFields(logFields)
|
entry.Logger = entry.Logger.WithFields(logFields)
|
||||||
|
|
||||||
|
|
@ -90,7 +90,7 @@ type StructuredLoggerEntry struct {
|
||||||
Logger logrus.FieldLogger
|
Logger logrus.FieldLogger
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *StructuredLoggerEntry) Write(status, bytes int, elapsed time.Duration) {
|
func (l *StructuredLoggerEntry) Write(status, bytes int, header http.Header, elapsed time.Duration, extra interface{}) {
|
||||||
l.Logger = l.Logger.WithFields(logrus.Fields{
|
l.Logger = l.Logger.WithFields(logrus.Fields{
|
||||||
"resp_status": status,
|
"resp_status": status,
|
||||||
"resp_bytes_length": bytes,
|
"resp_bytes_length": bytes,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue