mirror of
https://github.com/nektos/act.git
synced 2026-04-26 01:15:51 +03:00
[PR #1945] [CLOSED] feat: only print container logs with --focus #2203
Labels
No labels
area/action
area/cli
area/docs
area/image
area/runner
area/workflow
backlog
confirmed/not-planned
kind/bug
kind/discussion
kind/external
kind/feature-request
kind/question
meta/duplicate
meta/invalid
meta/need-more-info
meta/resolved
meta/wontfix
meta/workaround
needs-work
pull-request
review/not-planned
size/M
size/XL
size/XXL
stale
stale-exempt
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/act#2203
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/nektos/act/pull/1945
Author: @JeanMertz
Created: 8/5/2023
Status: ❌ Closed
Base:
master← Head:jean/focus-mode📝 Commits (1)
819c0a6feat: only print container logs with--focus📊 Changes
11 files changed (+78 additions, -10 deletions)
View changed files
📝
cmd/input.go(+1 -0)📝
cmd/root.go(+7 -0)📝
pkg/common/logger.go(+18 -0)📝
pkg/runner/action.go(+4 -1)📝
pkg/runner/action_composite.go(+4 -1)📝
pkg/runner/command.go(+1 -1)📝
pkg/runner/job_executor.go(+4 -1)📝
pkg/runner/logger.go(+23 -1)📝
pkg/runner/run_context.go(+11 -4)📝
pkg/runner/runner.go(+1 -0)📝
pkg/runner/step_docker.go(+4 -1)📄 Description
This PR introduces a new
--focus(-f) flag, which, when enabled, will suppress all logs except those emitted by the processes inside the running container.Doing so, reduces this:
To this:
The two differences are:
WARNor above.For those who really only want the process logs without any annotations, you can add
--jsonand then format the output usingjqetc, e.g.:The implementation itself works, but isn't as elegant as I would like because I didn't want to introduce any backward breaking changes.
I think, ideally, with two separate loggers (one for the process messages, the other for messages from act itself), there would be flags to control the log level of each individual logger, and do away with
--quiet,--focus, and--verbose.But, the current implementation works for me and doesn't introduce any backward breaking changes, so I figured I'd push this up, either for you to modify, or take as is.
One other alternative that I only thought of as I was writing this PR description, is to introduce a new field on the JSON-based log output, to distinguish between process and act logs. That way, we could again use
jqto filter out the logs we don't want. The downside is we'd lose the pretty printing niceties, so it's a trade-off of supporting this in the utility itself, or giving people the hooks to do it themselves outside the process.Edit: one more thing I forgot to mention — I didn't add any tests yet. I'm uncertain if/where logging output is tested, so feel free to either add it yourself, or give me some pointers, so I can see if I can find some additional time to add them.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.