feat: add stack_name to Docker Compose SDK log messages#17
Merged
veerendra2 merged 1 commit intomainfrom Apr 13, 2026
Merged
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds stack_name context to Docker Compose SDK warning logs (logrus → slog bridge) during LoadProject so warnings about unset env vars can be attributed to a specific stack.
Changes:
- Introduce a shared
slogHookthat stores the current stack name (RWMutex-protected) and attaches it to forwarded logrus messages. - Extend
slogWriterto optionally includestack_namein Docker CLI stream logs via the same hook. - Set/clear the hook’s stack name for the duration of
client.LoadProject()(derived fromfilepath.Base(WorkingDir)).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| pkg/dockercompose/logger.go | Adds stack-name-aware state to the logrus→slog hook and uses it when emitting slog records. |
| pkg/dockercompose/compose.go | Wires the hook into the client and sets stack_name around LoadProject; passes hook into slogWriter. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
stack_nameto warning logs emitted by the Docker Compose SDK (logrus → slog bridge) duringLoadProject, making it easy to identify which stack has unset environment variablesBefore
After
Test plan
stack_nameappears in the warning logs🤖 Generated with Claude Code