Skip to content

Commit

Permalink
Add Type function to context (#592)
Browse files Browse the repository at this point in the history
  • Loading branch information
clinta authored Oct 3, 2023
1 parent 8344fc0 commit 9e34cb4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions context.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,12 @@ func (c Context) Interface(key string, i interface{}) Context {
return c
}

// Type adds the field key with val's type using reflection.
func (c Context) Type(key string, val interface{}) Context {
c.l.context = enc.AppendType(enc.AppendKey(c.l.context, key), val)
return c
}

// Any is a wrapper around Context.Interface.
func (c Context) Any(key string, i interface{}) Context {
return c.Interface(key, i)
Expand Down

0 comments on commit 9e34cb4

Please sign in to comment.