Revise the loglevel API to be more golang idiomatic#165
Merged
Conversation
- LogLevel has a String method to convert the numeric level into its string version - There is only one name used to identify the default log level, and it is declared as a const `DefaultName` - Removed the "Get" name for functions that lookup a value. - A `DefaultLevel` function returns the current log level and handles locking. - Function to convert string to LogLevel is named `Parse`
SgtPooki
approved these changes
Jul 30, 2025
Member
SgtPooki
left a comment
There was a problem hiding this comment.
Makes sense. we’ll need to change kubo to address the new default name because i think there are expectations there of “*”.
Default name being an empty string or “*” make the same sense to me
| const DefaultName = "" | ||
|
|
||
| // String returns the name of a LogLevel. | ||
| func (lvl LogLevel) String() string { |
Member
|
This is really hurting downstream compatibility leading to the usual wac-a-mole of getting dependencies to work together (this being one of the dependencies that's used almost everywhere in our little ecosystem). Since it was a breaking change this would have been a good reason to /v3. In lieu of that, can we have these back please as aliases marked as deprecated? |
rvagg
added a commit
that referenced
this pull request
Oct 8, 2025
gammazero
pushed a commit
that referenced
this pull request
Oct 8, 2025
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.
Stringmethod when formatting the value (fmt.Print).DefaultNameDefaultNameconst can change with requiring any change is code that uses the const.DefaultLevelfunction returns the current log level and handles locking.Parse