log: use atomic types#27763
Merged
fjl merged 4 commits intoethereum:masterfrom Aug 4, 2023
Merged
Conversation
Khademr7
approved these changes
Jul 27, 2023
holiman
reviewed
Aug 1, 2023
| // locationEnabled is an atomic flag controlling whether the terminal formatter | ||
| // should append the log locations too when printing entries. | ||
| var locationEnabled uint32 | ||
| var locationEnabled atomic.Uint32 |
Contributor
There was a problem hiding this comment.
This should be an atomic.Bool, really. It's a small enough change that we might just as well fix it in this PR while we're at it, IMO,
holiman
reviewed
Aug 1, 2023
| override uint32 // Flag whether overrides are used, atomically accessible | ||
| backtrace uint32 // Flag whether backtrace location is set | ||
| level atomic.Uint32 // Current log level, atomically accessible | ||
| override atomic.Uint32 // Flag whether overrides are used, atomically accessible |
Contributor
There was a problem hiding this comment.
This could also be a boolean. Instead of setting it to len(filter), we would set it to len(filter) != 0
holiman
reviewed
Aug 1, 2023
| } | ||
| // If no local overrides are present, fast track skipping | ||
| if atomic.LoadUint32(&h.override) == 0 { | ||
| if h.override.Load() { |
Contributor
There was a problem hiding this comment.
It needs to be either
h.override.Store(len(filter) != 0) and check if !h.override.Load() {
or
h.override.Store(len(filter) == 0) and check if h.override.Load() {
holiman
reviewed
Aug 1, 2023
| backtrace uint32 // Flag whether backtrace location is set | ||
| level atomic.Uint32 // Current log level, atomically accessible | ||
| override atomic.Bool // Flag whether overrides are used, atomically accessible | ||
| backtrace atomic.Uint32 // Flag whether backtrace location is set |
Contributor
There was a problem hiding this comment.
hm, backtrace also looks very boolean, in it's usage, to me :)
e0b71c0 to
0d9e6fd
Compare
devopsbo3
pushed a commit
to HorizenOfficial/go-ethereum
that referenced
this pull request
Nov 10, 2023
Co-authored-by: Felix Lange <fjl@twurst.com>
devopsbo3
added a commit
to HorizenOfficial/go-ethereum
that referenced
this pull request
Nov 10, 2023
This reverts commit 818db9b.
devopsbo3
added a commit
to HorizenOfficial/go-ethereum
that referenced
this pull request
Nov 10, 2023
This reverts commit 818db9b.
gzliudan
added a commit
to gzliudan/XDPoSChain
that referenced
this pull request
Nov 15, 2024
Co-authored-by: Felix Lange <fjl@twurst.com>
19 tasks
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.
No description provided.