Skip to content

[log] Add debug logging to config/docker_helpers.go#2824

Merged
lpcox merged 1 commit intomainfrom
add-debug-logging-docker-helpers-035a78b0bbe69f08
Mar 30, 2026
Merged

[log] Add debug logging to config/docker_helpers.go#2824
lpcox merged 1 commit intomainfrom
add-debug-logging-docker-helpers-035a78b0bbe69f08

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

Enhances internal/config/docker_helpers.go with debug logging using the existing logDockerHelpers logger ("config:docker_helpers").

Changes

Six new logDockerHelpers.Printf(...) calls added to Docker inspection functions that previously had no debug output:

Function New log calls
runDockerInspect Entry log with containerID/format, success log with output_len
checkPortMapping Entry log with containerID/port, result log with mapped status
checkStdinInteractive Result log with containerID/interactive flag
checkLogDirMounted Result log with containerID/logDir/mounted flag

The ExpandEnvArgs function already had logging; the other functions previously had none.

Usage

Enable with:

DEBUG=config:docker_helpers ./awmg --config config.toml

Or together with other docker-related namespaces:

DEBUG=config:* ./awmg --config config.toml

Checklist

  • Exactly 1 file modified
  • No test files modified
  • Reuses existing logDockerHelpers = logger.New("config:docker_helpers") declaration
  • Logger naming follows pkg:filename convention
  • Log arguments don't compute anything or cause side effects
  • Messages are meaningful and include key diagnostic fields
  • No duplicate logging with existing logs

Generated by Go Logger Enhancement ·

Enhance docker_helpers.go with debug logging using the existing
logDockerHelpers logger to improve troubleshooting of Docker operations:

- runDockerInspect: log before executing the docker inspect command and
  after success with output length
- checkPortMapping: log entry with containerID/port and result with
  mapped status
- checkStdinInteractive: log result with containerID and interactive flag
- checkLogDirMounted: log result with containerID, logDir, and mounted status

These debug logs are controlled via DEBUG=config:docker_helpers and help
diagnose Docker environment validation issues during gateway startup.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions bot added automation enhancement New feature or request labels Mar 30, 2026
@lpcox lpcox marked this pull request as ready for review March 30, 2026 15:15
Copilot AI review requested due to automatic review settings March 30, 2026 15:15
@lpcox lpcox merged commit 0d7e8ec into main Mar 30, 2026
3 checks passed
@lpcox lpcox deleted the add-debug-logging-docker-helpers-035a78b0bbe69f08 branch March 30, 2026 15:15
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds targeted debug logging to Docker inspection helpers in internal/config/docker_helpers.go to make containerized environment validation easier to diagnose when DEBUG=config:docker_helpers is enabled.

Changes:

  • Added entry/success logging to runDockerInspect (including output length).
  • Added input/result logging to checkPortMapping, plus result logging to checkStdinInteractive and checkLogDirMounted.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

return "", err
}

logDockerHelpers.Printf("Running docker inspect: containerID=%s, format=%s", containerID, formatTemplate)
Copy link

Copilot AI Mar 30, 2026

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, formatTemplate is a Go template (contains braces/quotes) and containerID is an identifier; using %q for formatTemplate (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.

Suggested change
logDockerHelpers.Printf("Running docker inspect: containerID=%s, format=%s", containerID, formatTemplate)
logDockerHelpers.Printf("Running docker inspect: containerID=%q, format=%q", containerID, formatTemplate)

Copilot uses AI. Check for mistakes.

return strings.TrimSpace(string(output)), nil
result := strings.TrimSpace(string(output))
logDockerHelpers.Printf("Docker inspect succeeded: output_len=%d", len(result))
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The output_len field is computed from the trimmed string (len(result)), which may not match the raw docker inspect output size and is counted in bytes (Go string length). Consider either logging len(output) (raw bytes) or renaming the field to something like trimmed_len/result_len to avoid misleading diagnostics.

Suggested change
logDockerHelpers.Printf("Docker inspect succeeded: output_len=%d", len(result))
logDockerHelpers.Printf("Docker inspect succeeded: result_len=%d", len(result))

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants