Skip to content
Snippets Groups Projects
Commit d36907de authored by Semyon Krestyaninov's avatar Semyon Krestyaninov
Browse files

refactor Channels

parent 9d386e8a
No related branches found
No related tags found
No related merge requests found
......@@ -16,7 +16,7 @@ const (
func ContainsChannels(channels ...string) FilterFunc {
return func(entry zapcore.Entry, fields []zapcore.Field) bool {
for _, f := range fields {
if f.Key == channelKey && f.Type == zapcore.ArrayMarshalerType {
if f.Key == channelKey && f.Type == zapcore.SkipType {
for _, v := range f.Interface.(stringArray) {
if data.Contains(v, channels) {
return true
......
......@@ -20,7 +20,11 @@ func (ss stringArray) MarshalLogArray(arr zapcore.ArrayEncoder) error {
}
func Channels(channels ...string) zap.Field {
return zap.Array(channelKey, stringArray(channels))
return zap.Field{
Key: channelKey,
Type: zapcore.SkipType, // используем тип zapcore.SkipType, чтобы поле игнорировалось при выводе записи
Interface: stringArray(channels),
}
}
func Category(category string) zap.Field {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment