func getNearestAncestor(comparable gorivets.Comparable, names *gorivets.SortedSlice) logNameProvider { if names.Len() == 0 { return nil } nProvider := comparable.(logNameProvider) for idx := gorivets.Min(names.Len()-1, names.GetInsertPos(nProvider.(gorivets.Comparable))); idx >= 0; idx-- { candidate := names.At(idx).(logNameProvider) if ancestor(candidate.name(), nProvider.name()) { return candidate } } return nil }
/** * Stores level setting for the provided loggerName * Params: * loggerName - should be eligable normalized logger name */ func setLogLevel(level Level, loggerName string, logLevels *gorivets.SortedSlice) *logLevelSetting { if level < 0 { return nil } var lls *logLevelSetting = &logLevelSetting{loggerName, level} idx, found := logLevels.Find(lls) if found { lls = logLevels.At(idx).(*logLevelSetting) lls.level = level } else { logLevels.Add(lls) } return lls }