Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant