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

Use log.Ctx for all logging calls #2001

Closed
wjam opened this issue Feb 21, 2023 · 1 comment
Closed

Use log.Ctx for all logging calls #2001

wjam opened this issue Feb 21, 2023 · 1 comment

Comments

@wjam
Copy link
Contributor

wjam commented Feb 21, 2023

A number of different fields are added to a logger that is stored within the context. We should ensure all logging calls use the log.Ctx(..).Info pattern rather than log.Info.

Ideally, we should also have linting step which enforces this.

@github-project-automation github-project-automation bot moved this to Triage (Unprioritized) in Bacalhau Main Feb 21, 2023
@wjam
Copy link
Contributor Author

wjam commented Feb 21, 2023

Using log.Ctx for some logging calls will be blocked by hashicorp/go-retryablehttp#182

wjam added a commit that referenced this issue Feb 22, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
This adds a second type of clean up function - one that takes a
`context.Context`. This makes it easier to avoid problems of using
a cancelled context when cleaning up, as the logic doesn't need to be
spread about, and makes it easy to migrate a portion of log statements
that aren't using `log.Ctx` to do so.

Part of #2001
wjam added a commit that referenced this issue Feb 22, 2023
This adds a second type of clean up function - one that takes a
`context.Context`. This makes it easier to avoid problems of using
a cancelled context when cleaning up, as the logic doesn't need to be
spread about, and makes it easy to migrate a portion of log statements
that aren't using `log.Ctx` to do so.

Part of #2001
wjam added a commit that referenced this issue Feb 22, 2023
This adds a second type of clean up function - one that takes a
`context.Context`. This makes it easier to avoid problems of using
a cancelled context when cleaning up, as the logic doesn't need to be
spread about, and makes it easy to migrate a portion of log statements
that aren't using `log.Ctx` to do so.

Part of #2001
wjam added a commit that referenced this issue Feb 22, 2023
This adds a second type of clean up function - one that takes a
`context.Context`. This makes it easier to avoid problems of using a
cancelled context when cleaning up, as the logic doesn't need to be
spread about, and makes it easy to migrate a portion of log statements
that aren't using `log.Ctx` to do so.

Part of #2001
wjam added a commit that referenced this issue Feb 23, 2023
Use `log.Ctx` for more logging statements. Also move the
`signal.NotifyContext` calls to the root command so all commands can
cleanly tidy up.

Part #2001
wjam added a commit that referenced this issue Feb 23, 2023
Use `log.Ctx` for more logging statements. Also move the
`signal.NotifyContext` calls to the root command so all commands can
cleanly tidy up.

Part #2001
@github-project-automation github-project-automation bot moved this from Triage (Unprioritized) to To Celebrate in Bacalhau Main Jan 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants