func extractLogData()

in collector/receiver/prometheusreceiver/internal/logger.go [61:89]


func extractLogData(keyvals []interface{}) logData {
	ld := logData{
		level: level.InfoValue(), // default
	}

	for i := 0; i < len(keyvals); i += 2 {
		key := keyvals[i]
		val := keyvals[i+1]

		if l, ok := matchLogLevel(key, val); ok {
			ld.level = l
			continue
		}

		if m, ok := matchLogMessage(key, val); ok {
			ld.msg = m
			continue
		}

		if err, ok := matchError(key, val); ok {
			ld.otherFields = append(ld.otherFields, zap.Error(err))
			continue
		}

		ld.otherFields = append(ld.otherFields, key, val)
	}

	return ld
}