update ling and go version
This commit is contained in:
@@ -5,7 +5,7 @@ name: logger
|
||||
|
||||
steps:
|
||||
- name: test
|
||||
image: golang:1.21.5
|
||||
image: golang:1.22
|
||||
volumes:
|
||||
- name: deps
|
||||
path: /go/src/mod
|
||||
@@ -13,7 +13,7 @@ steps:
|
||||
- go test
|
||||
|
||||
- name: golangci-lint
|
||||
image: golangci/golangci-lint:v1.55
|
||||
image: golangci/golangci-lint:v1.57
|
||||
commands:
|
||||
- golangci-lint run
|
||||
|
||||
|
||||
@@ -166,7 +166,9 @@ func BenchmarkDisabledAccumulatedContext(b *testing.B) {
|
||||
|
||||
b.Run("4devs/log.Context", func(b *testing.B) {
|
||||
b.ResetTimer()
|
||||
|
||||
logger := NewLogger().With(log.GoVersion("goversion"))
|
||||
|
||||
b.RunParallel(func(pb *testing.PB) {
|
||||
for pb.Next() {
|
||||
logger.InfoKV(ctx, getMessage(0), fakeFields()...)
|
||||
|
||||
@@ -21,7 +21,7 @@ func main() {
|
||||
logger.AlertKV(ctx, "alert message new logger", field.String("string", "value"))
|
||||
service(ctx, logger)
|
||||
|
||||
strLogger := log.New(log.WithFormat(log.FormatWithBracket())).With(log.WithSource(10, log.TrimPath), log.WithTime(log.KeyTime, time.RFC3339))
|
||||
strLogger := log.New(log.WithFormat(log.FormatWithBracket(field.NewEncoderText()))).With(log.WithSource(10, log.TrimPath), log.WithTime(log.KeyTime, time.RFC3339))
|
||||
strLogger.AlertKV(ctx, "alert message new txt logger", field.String("string", "value"))
|
||||
service(ctx, strLogger)
|
||||
}
|
||||
|
||||
@@ -174,6 +174,7 @@ func needsQuoting(in string) bool {
|
||||
if char != '\\' && (char == ' ' || char == '=' || !safeSet[char]) {
|
||||
return true
|
||||
}
|
||||
|
||||
i++
|
||||
|
||||
continue
|
||||
|
||||
@@ -38,6 +38,7 @@ func With(logger Logger, mw ...Middleware) Logger {
|
||||
if curI == lastI {
|
||||
return logger(currentCtx, currentEntry)
|
||||
}
|
||||
|
||||
curI++
|
||||
n, err := mw[curI](currentCtx, currentEntry, chainHandler)
|
||||
curI--
|
||||
|
||||
Reference in New Issue
Block a user