Skip to content

Commit

Permalink
Merge branch 'main' into zapbench
Browse files Browse the repository at this point in the history
  • Loading branch information
pellared authored Jun 25, 2024
2 parents f7ff9d0 + 669ca60 commit 2a5db7b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions bridges/otelzap/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ func (o *Core) Write(ent zapcore.Entry, fields []zapcore.Field) error {
r.SetTimestamp(ent.Time)
r.SetBody(log.StringValue(ent.Message))
r.SetSeverity(convertLevel(ent.Level))
r.SetSeverityText(ent.Level.String())

// TODO: Handle ent.LoggerName.

Expand Down
4 changes: 4 additions & 0 deletions bridges/otelzap/core_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ func TestCore(t *testing.T) {
got := rec.Result()[0].Records[0]
assert.Equal(t, testMessage, got.Body().AsString())
assert.Equal(t, log.SeverityInfo, got.Severity())
assert.Equal(t, zap.InfoLevel.String(), got.SeverityText())
assert.Equal(t, 1, got.AttributesLen())
got.WalkAttributes(func(kv log.KeyValue) bool {
assert.Equal(t, testKey, string(kv.Key))
Expand All @@ -62,6 +63,7 @@ func TestCore(t *testing.T) {
got := rec.Result()[0].Records[0]
assert.Equal(t, testMessage, got.Body().AsString())
assert.Equal(t, log.SeverityInfo, got.Severity())
assert.Equal(t, zap.InfoLevel.String(), got.SeverityText())
assert.Equal(t, 2, got.AttributesLen())

index := 0
Expand All @@ -84,6 +86,7 @@ func TestCore(t *testing.T) {
got := rec.Result()[0].Records[0]
assert.Equal(t, testMessage, got.Body().AsString())
assert.Equal(t, log.SeverityInfo, got.Severity())
assert.Equal(t, zap.InfoLevel.String(), got.SeverityText())
assert.Equal(t, 3, got.AttributesLen())

index := 0
Expand Down Expand Up @@ -119,6 +122,7 @@ func TestCoreEnabled(t *testing.T) {
got := r.Result()[0].Records[0]
assert.Equal(t, testMessage, got.Body().AsString())
assert.Equal(t, log.SeverityInfo, got.Severity())
assert.Equal(t, zap.InfoLevel.String(), got.SeverityText())
}

func TestNewCoreConfiguration(t *testing.T) {
Expand Down

0 comments on commit 2a5db7b

Please sign in to comment.