func()

in collector/internal/levelchanger/levelchanger.go [50:66]


func (l levelChangerCore) Write(entry zapcore.Entry, fields []zapcore.Field) error {
	// Always pass if there are no conditions, otherwise check if any conditions are met.
	changeLevels := len(l.conditions) == 0
	for _, condition := range l.conditions {
		changeLevels = changeLevels || condition(entry, fields)
	}

	if changeLevels && entry.Level == l.fromLevel {
		entry.Level = l.toLevel
	}

	// Check if the next core is enabled at the (potentially) new log level.
	if !l.next.Enabled(entry.Level) {
		return nil
	}
	return l.next.Write(entry, fields)
}