-
Notifications
You must be signed in to change notification settings - Fork 21
[log] Add debug logging to config/docker_helpers.go #2824
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -73,17 +73,23 @@ func runDockerInspect(containerID, formatTemplate string) (string, error) { | |||||
| return "", err | ||||||
| } | ||||||
|
|
||||||
| logDockerHelpers.Printf("Running docker inspect: containerID=%s, format=%s", containerID, formatTemplate) | ||||||
|
|
||||||
| cmd := exec.Command("docker", "inspect", "--format", formatTemplate, containerID) | ||||||
| output, err := cmd.Output() | ||||||
| if err != nil { | ||||||
| return "", fmt.Errorf("docker inspect failed: %w", err) | ||||||
| } | ||||||
|
|
||||||
| return strings.TrimSpace(string(output)), nil | ||||||
| result := strings.TrimSpace(string(output)) | ||||||
| logDockerHelpers.Printf("Docker inspect succeeded: output_len=%d", len(result)) | ||||||
|
||||||
| logDockerHelpers.Printf("Docker inspect succeeded: output_len=%d", len(result)) | |
| logDockerHelpers.Printf("Docker inspect succeeded: result_len=%d", len(result)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For log readability/parsing, consider quoting string fields that may contain spaces/special chars. In particular,
formatTemplateis a Go template (contains braces/quotes) andcontainerIDis an identifier; using%qforformatTemplate(and possibly for other string fields in these new logs) will make the output unambiguous and help avoid multi-field confusion if the template ever includes whitespace.