Skip to content

When debug is enabled, all loggers set report caller to true#2631

Open
pcarranza wants to merge 1 commit intonektos:masterfrom
pcarranza:pc/set-report-caller-on-debug
Open

When debug is enabled, all loggers set report caller to true#2631
pcarranza wants to merge 1 commit intonektos:masterfrom
pcarranza:pc/set-report-caller-on-debug

Conversation

@pcarranza
Copy link

This change is only to improve debugging visibility by enabling logrus SetReportCaller when 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.

@codecov
Copy link

codecov bot commented Feb 25, 2025

Codecov Report

Attention: Patch coverage is 25.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 68.70%. Comparing base (5a80a04) to head (d846f90).
Report is 178 commits behind head on master.

Files with missing lines Patch % Lines
cmd/root.go 0.00% 3 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

@mergify mergify bot added the needs-work Extra attention is needed label Feb 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-work Extra attention is needed size/XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants