Skip to content

Commit

Permalink
Add trc1log wrapped logger (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
advayakrishna authored Mar 26, 2021
1 parent a82a6e1 commit c8ffecf
Show file tree
Hide file tree
Showing 16 changed files with 426 additions and 346 deletions.
5 changes: 5 additions & 0 deletions changelog/@unreleased/pr-128.v2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
type: improvement
improvement:
description: Add trc1log wrapped logger
links:
- https://github.com/palantir/witchcraft-go-logging/pull/128
2 changes: 0 additions & 2 deletions wlog-glog/internal/marshalers/marshalers.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@ import (
"reflect"

"github.com/palantir/witchcraft-go-logging/conjure/witchcraft/api/logging"
"github.com/palantir/witchcraft-go-tracing/wtracing"
)

type encoderFunc func(key string, val interface{}) string

var encoders = map[reflect.Type]encoderFunc{
reflect.TypeOf(wtracing.SpanModel{}): marshalWTracingSpanModel,
reflect.TypeOf(logging.Diagnostic{}): marshalLoggingDiagnostic,
}

Expand Down
127 changes: 0 additions & 127 deletions wlog-glog/internal/marshalers/wtracing_spanmodel.go

This file was deleted.

2 changes: 1 addition & 1 deletion wlog-glog/logger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ func TestWrapped1Log(t *testing.T) {

entityName := "entity"
entityVersion := "version"
for _, tc := range wrapped1logtests.TestCases(entityName, entityVersion) {
for _, tc := range wrapped1logtests.Svc1TestCases(entityName, entityVersion) {
// TODO: test output
logger := wrapped1log.NewFromProvider(
os.Stdout,
Expand Down
2 changes: 0 additions & 2 deletions wlog-zap/internal/marshalers/marshalers.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,12 @@ import (
"reflect"

"github.com/palantir/witchcraft-go-logging/conjure/witchcraft/api/logging"
"github.com/palantir/witchcraft-go-tracing/wtracing"
"go.uber.org/zap/zapcore"
)

type encoderFunc func(key string, val interface{}) zapcore.Field

var encoders = map[reflect.Type]encoderFunc{
reflect.TypeOf(wtracing.SpanModel{}): marshalWTracingSpanModel,
reflect.TypeOf(logging.Diagnostic{}): marshalLoggingDiagnostic,
}

Expand Down
99 changes: 0 additions & 99 deletions wlog-zap/internal/marshalers/wtracing_spanmodel.go

This file was deleted.

12 changes: 12 additions & 0 deletions wlog-zap/logger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,15 @@ func TestWrapped1LogSvc1Log(t *testing.T) {
return wrapped1log.NewFromProvider(w, level, zapimpl.LoggerProvider(), entityName, entityVersion).Service(svc1log.Origin(origin))
})
}

func TestWrapped1LogTrc1Log(t *testing.T) {
entityName := "entity"
entityVersion := "version"
wrapped1logtests.Trc1LogJSONTestSuite(
t,
entityName,
entityVersion,
func(w io.Writer) trc1log.Logger {
return wrapped1log.NewFromProvider(w, wlog.InfoLevel, zapimpl.LoggerProvider(), entityName, entityVersion).Trace()
})
}
2 changes: 0 additions & 2 deletions wlog-zerolog/internal/marshalers/marshalers.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"reflect"

"github.com/palantir/witchcraft-go-logging/conjure/witchcraft/api/logging"
"github.com/palantir/witchcraft-go-tracing/wtracing"
"github.com/rs/zerolog"
)

Expand All @@ -37,7 +36,6 @@ func (f logArrayMarshalerFn) MarshalZerologArray(a *zerolog.Array) {
}

var encoders = map[reflect.Type]encoderFunc{
reflect.TypeOf(wtracing.SpanModel{}): marshalWTracingSpanModel,
reflect.TypeOf(logging.Diagnostic{}): marshalLoggingDiagnostic,
}

Expand Down
84 changes: 0 additions & 84 deletions wlog-zerolog/internal/marshalers/wtracing_spanmodel.go

This file was deleted.

Loading

0 comments on commit c8ffecf

Please sign in to comment.