- 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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user