Skip to content

Commit

Permalink
remove span error mark
Browse files Browse the repository at this point in the history
  • Loading branch information
yinheli committed Jul 23, 2021
1 parent bf7e5ec commit a3ccc46
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions pkg/log/spanlogger.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"time"

"github.com/opentracing/opentracing-go"
"github.com/opentracing/opentracing-go/ext"
"github.com/opentracing/opentracing-go/log"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
Expand Down Expand Up @@ -52,14 +51,12 @@ func (t spanLogger) Warn(msg string, fields ...zapcore.Field) {
// Error log message
func (t spanLogger) Error(msg string, fields ...zapcore.Field) {
t.logToSpan("error", msg, fields...)
t.markError()
t.logger.Error(msg, append(t.spanFields, fields...)...)
}

// Fatal log message
func (t spanLogger) Fatal(msg string, fields ...zapcore.Field) {
t.logToSpan("fatal", msg, append(t.additionalFields, fields...)...)
t.markError()
t.logger.Fatal(msg, append(t.spanFields, fields...)...)
}

Expand Down Expand Up @@ -94,16 +91,6 @@ func (t spanLogger) logToSpan(level string, msg string, fields ...zapcore.Field)
t.span.LogFields(fs...)
}

func (t spanLogger) markError() {
ek := "__error"
if t.span.BaggageItem(ek) != "" {
return
}

t.span.SetBaggageItem(ek, "true")
ext.Error.Set(t.span, true)
}

// zapFieldToLogField to opentracing log field
func zapFieldToLogField(field zapcore.Field) log.Field {
switch field.Type {
Expand Down

0 comments on commit a3ccc46

Please sign in to comment.