Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
34 lines (27 sloc) 748 Bytes
package zapx
import (
// FieldSetMarshaller is the underlying type used by zapx.Fields()
type FieldSetMarshaller interface {
Fields() []zap.Field
type fieldSet []zap.Field
func (f fieldSet) MarshalLogObject(enc zapcore.ObjectEncoder) error {
for i := range f {
return nil
func (f fieldSet) Fields() []zap.Field { return f }
// FieldSet allows logging of sets of fields as a log object
// TODO: not as performant as testdata.Obj for some reason, need to look into why
func FieldSet(key string, fields ...zap.Field) zap.Field {
return zap.Field{
Key: key,
Type: zapcore.ObjectMarshalerType,
Interface: fieldSet(fields),
You can’t perform that action at this time.