You can make those fields custom type and implement Stringer interface for them printing ****. For example:
type X string
func (x X) String() string {
return "***"
}
func main() {
x := X("aaaaa")
log.Infow("msg", "x", x)
}
will print msg {"x": "***"}.
Or you can implement your own version of Encoder where you would filter fields by name or their type Interface in EncodeEntry(ent Entry, fields []Field) function. You can take one of the two existing encoders - console or json - as a base. For example:
You can make those fields custom type and implement Stringer interface for them printing
****. For example:will print
msg {"x": "***"}.Or you can implement your own version of
Encoderwhere you would filter fields by name or their typeInterfaceinEncodeEntry(ent Entry, fields []Field)function. You can take one of the two existing encoders - console or json - as a base. For example:This will print