When debug is enabled, all loggers set report caller to true#2631
Open
pcarranza wants to merge 1 commit intonektos:masterfrom
Open
When debug is enabled, all loggers set report caller to true#2631pcarranza wants to merge 1 commit intonektos:masterfrom
pcarranza wants to merge 1 commit intonektos:masterfrom
Conversation
This was referenced Jan 26, 2025
cplee
approved these changes
Feb 25, 2025
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2631 +/- ##
==========================================
+ Coverage 61.56% 68.70% +7.14%
==========================================
Files 53 71 +18
Lines 9002 10922 +1920
==========================================
+ Hits 5542 7504 +1962
+ Misses 3020 2854 -166
- Partials 440 564 +124 ☔ View full report in Codecov by Sentry. |
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.
This change is only to improve debugging visibility by enabling logrus
SetReportCallerwhen the logger is set to debug level (verbose) - Bear in mind that because there's a specific formatter when in text mode, the report caller fields will only be visible in all loggers when the JSON logger is enabled too.Why this change
This change is a side effect of #2609 in which @ChristopherHX challenged that the error of not showing why this is happening belongs to Gitea Act runner and not Nektos Act. I think he's right, but because of how thin the logging is it is tough to understand where the error is being reported, hence I introduced this change (disabled by default in normal operations) to simplify the work of debugging by dumping which line is the one called when something is being logged.
Logs look like this when this is enabled:
{"file":"/home/pcarranza/go/src/github.com/pcarranza/act/pkg/container/docker_socket.go:63","func":"github.com/nektos/act/pkg/container.GetSocketAndHost","level":"debug","msg":"Handling container host and socket","time":"2025-01-26T12:31:33+01:00"} {"file":"/home/pcarranza/go/src/github.com/pcarranza/act/pkg/container/docker_socket.go:99","func":"github.com/nektos/act/pkg/container.GetSocketAndHost","level":"debug","msg":"Defaulting container socket to DOCKER_HOST","time":"2025-01-26T12:31:33+01:00"}Then
{"dryrun":false,"file":"/home/pcarranza/go/src/github.com/pcarranza/act/pkg/common/executor.go:38","func":"github.com/nektos/act/pkg/container.(*containerReference).Exec.NewInfoExecutor.func1","job":"testing/monolith","jobID":"monolith","level":"info","matrix":{},"msg":" 🐳 docker exec cmd=[/opt/acttoolcache/node/18.20.5/x64/bin/node /var/run/act/actions/docker-login-action@v3/dist/index.js] user= workdir=","stage":"Main","step":"Login to GitLab Registry","stepID":["0"],"time":"2025-01-26T12:31:38+01:00"}Greatly simplifying following what is being called when from where.