in http/common/logging/logging.go [46:81]
func GetMethodInfo(method string, rawURL string) string {
// Trim the URL to ensure it starts with "/subscriptions"
validURL := trimToSubscription(rawURL)
// First, try to parse validURL as a full resource ID.
id, err := arm.ParseResourceID(validURL)
if err != nil {
// Retry by appending a false resource name ("dummy")
// To be a valid resource ID, the URL must end with the resource name.
fakeURL := validURL
if !strings.HasSuffix(validURL, "/dummy") {
fakeURL = validURL + "/dummy"
}
id, err = arm.ParseResourceID(fakeURL)
if err != nil {
// Fallback: if parsing still fails, use the full URL.
return method + " " + rawURL
}
// We know a fake resource name was added.
if method == "GET" {
// For GET requests with a fake name, we assume it's a list operation.
return method + " " + sanitizeResourceType(id.ResourceType.String(), rawURL) + " - LIST"
}
return method + " " + sanitizeResourceType(id.ResourceType.String(), rawURL)
}
// If parsing was successful on the first try.
if method == "GET" {
op := " - READ"
if strings.TrimSpace(id.Name) == "" {
op = " - LIST"
}
return method + " " + sanitizeResourceType(id.ResourceType.String(), rawURL) + op
}
return method + " " + sanitizeResourceType(id.ResourceType.String(), rawURL)
}