(chore): document and test new LogLevel APIs
Golang lint / lint (push) Successful in 47s

- add godoc for SameLevel and Equal
- update package docs and READMEs with new helpers
- refresh unreleased release notes
- add tests for Printf, HTTP method levels, and level constructors
This commit is contained in:
2026-04-27 17:04:41 +03:00
parent 812caed471
commit b7fa3f7606
6 changed files with 197 additions and 2 deletions
+47
View File
@@ -196,3 +196,50 @@ func (l *LogLevel) GetAttributes() []Attribute {
copy(attrs, l.attrs)
return attrs
}
// SameLevel reports whether two log levels have the same severity index.
func (l *LogLevel) SameLevel(other LogLevel) bool {
return l.n == other.n
}
// Equal reports whether two log levels have identical configuration.
func (l *LogLevel) Equal(other LogLevel) bool {
if l.t != other.t || l.n != other.n {
return false
}
if l.fg != other.fg || l.bg != other.bg {
return false
}
if l.fg256 != other.fg256 || l.bg256 != other.bg256 {
return false
}
if len(l.attrs) != len(other.attrs) {
return false
}
for i := range l.attrs {
if l.attrs[i] != other.attrs[i] {
return false
}
}
if len(l.fgRgb) != len(other.fgRgb) {
return false
}
for i := range l.fgRgb {
if l.fgRgb[i] != other.fgRgb[i] {
return false
}
}
if len(l.bgRgb) != len(other.bgRgb) {
return false
}
for i := range l.bgRgb {
if l.bgRgb[i] != other.bgRgb[i] {
return false
}
}
return true
}