Skip to content

Commit

Permalink
Document when ObjectMarshaler and ArrayMarshaler are used (uber-go#837)
Browse files Browse the repository at this point in the history
  • Loading branch information
prashantv committed Jun 11, 2020
1 parent 981f1de commit e847f0d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions zapcore/marshaler.go
Expand Up @@ -23,6 +23,10 @@ package zapcore
// ObjectMarshaler allows user-defined types to efficiently add themselves to the
// logging context, and to selectively omit information which shouldn't be
// included in logs (e.g., passwords).
//
// Note: ObjectMarshaler is only used when zap.Object is used or when
// passed directly to zap.Any. It is not used when reflection-based
// encoding is used.
type ObjectMarshaler interface {
MarshalLogObject(ObjectEncoder) error
}
Expand All @@ -39,6 +43,10 @@ func (f ObjectMarshalerFunc) MarshalLogObject(enc ObjectEncoder) error {
// ArrayMarshaler allows user-defined types to efficiently add themselves to the
// logging context, and to selectively omit information which shouldn't be
// included in logs (e.g., passwords).
//
// Note: ArrayMarshaler is only used when zap.Array is used or when
// passed directly to zap.Any. It is not used when reflection-based
// encoding is used.
type ArrayMarshaler interface {
MarshalLogArray(ArrayEncoder) error
}
Expand Down

0 comments on commit e847f0d

Please sign in to comment.