slog: rename levels from XLevel to LevelX
Follow the usual standard library convention.
Change-Id: I54044f07a876ad3a28132b40cf53891fc90fa9e3
Reviewed-on: https://go-review.googlesource.com/c/exp/+/456620
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
diff --git a/slog/benchmarks/benchmarks_test.go b/slog/benchmarks/benchmarks_test.go
index a12b2e9..0611257 100644
--- a/slog/benchmarks/benchmarks_test.go
+++ b/slog/benchmarks/benchmarks_test.go
@@ -41,7 +41,7 @@
// should only be from Duration.String and Time.String.
"5 args",
func() {
- logger.LogAttrs(slog.InfoLevel, TestMessage,
+ logger.LogAttrs(slog.LevelInfo, TestMessage,
slog.String("string", TestString),
slog.Int("status", TestInt),
slog.Duration("duration", TestDuration),
@@ -53,7 +53,7 @@
{
"5 args ctx",
func() {
- logger.WithContext(ctx).LogAttrs(slog.InfoLevel, TestMessage,
+ logger.WithContext(ctx).LogAttrs(slog.LevelInfo, TestMessage,
slog.String("string", TestString),
slog.Int("status", TestInt),
slog.Duration("duration", TestDuration),
@@ -65,7 +65,7 @@
{
"10 args",
func() {
- logger.LogAttrs(slog.InfoLevel, TestMessage,
+ logger.LogAttrs(slog.LevelInfo, TestMessage,
slog.String("string", TestString),
slog.Int("status", TestInt),
slog.Duration("duration", TestDuration),
@@ -82,7 +82,7 @@
{
"40 args",
func() {
- logger.LogAttrs(slog.InfoLevel, TestMessage,
+ logger.LogAttrs(slog.LevelInfo, TestMessage,
slog.String("string", TestString),
slog.Int("status", TestInt),
slog.Duration("duration", TestDuration),
diff --git a/slog/benchmarks/handlers_test.go b/slog/benchmarks/handlers_test.go
index a16c6a7..b1e906d 100644
--- a/slog/benchmarks/handlers_test.go
+++ b/slog/benchmarks/handlers_test.go
@@ -9,7 +9,7 @@
)
func TestHandlers(t *testing.T) {
- r := slog.NewRecord(TestTime, slog.InfoLevel, TestMessage, 0, nil)
+ r := slog.NewRecord(TestTime, slog.LevelInfo, TestMessage, 0, nil)
r.AddAttrs(TestAttrs...)
t.Run("text", func(t *testing.T) {
var b bytes.Buffer
diff --git a/slog/doc.go b/slog/doc.go
index 09c601e..ed32e0c 100644
--- a/slog/doc.go
+++ b/slog/doc.go
@@ -102,7 +102,7 @@
The call
- logger.LogAttrs(slog.InfoLevel, "hello", slog.Int("count", 3))
+ logger.LogAttrs(slog.LevelInfo, "hello", slog.Int("count", 3))
is the most efficient way to achieve the same output as
@@ -140,7 +140,7 @@
Now the program can change its logging level with a single statement:
- programLevel.Set(slog.DebugLevel)
+ programLevel.Set(slog.LevelDebug)
# Configuring the built-in handlers
diff --git a/slog/example_level_handler_test.go b/slog/example_level_handler_test.go
index b66a812..5374447 100644
--- a/slog/example_level_handler_test.go
+++ b/slog/example_level_handler_test.go
@@ -64,7 +64,7 @@
},
}.NewTextHandler(os.Stdout)
- logger := slog.New(NewLevelHandler(slog.WarnLevel, th))
+ logger := slog.New(NewLevelHandler(slog.LevelWarn, th))
logger.Info("not printed")
logger.Warn("printed")
diff --git a/slog/handler.go b/slog/handler.go
index 778c932..7fcf1da 100644
--- a/slog/handler.go
+++ b/slog/handler.go
@@ -77,7 +77,7 @@
}
func (*defaultHandler) Enabled(l Level) bool {
- return l >= InfoLevel
+ return l >= LevelInfo
}
// Collect the level, attributes and message in a string and
@@ -116,7 +116,7 @@
// Level reports the minimum record level that will be logged.
// The handler discards records with lower levels.
- // If Level is nil, the handler assumes InfoLevel.
+ // If Level is nil, the handler assumes LevelInfo.
// The handler calls Level.Level for each record processed;
// to adjust the minimum level dynamically, use a LevelVar.
Level Leveler
@@ -195,7 +195,7 @@
// Enabled reports whether l is greater than or equal to the
// minimum level.
func (h *commonHandler) enabled(l Level) bool {
- minLevel := InfoLevel
+ minLevel := LevelInfo
if h.opts.Level != nil {
minLevel = h.opts.Level.Level()
}
diff --git a/slog/handler_test.go b/slog/handler_test.go
index be4a925..a9c73ac 100644
--- a/slog/handler_test.go
+++ b/slog/handler_test.go
@@ -91,7 +91,7 @@
if test.with != nil {
h = test.with(h)
}
- r := NewRecord(time.Time{}, InfoLevel, "message", 0, nil)
+ r := NewRecord(time.Time{}, LevelInfo, "message", 0, nil)
r.AddAttrs(test.attrs...)
if err := h.Handle(r); err != nil {
t.Fatal(err)
@@ -283,7 +283,7 @@
wantJSON: `{"msg":"message","bs":1234}`,
},
} {
- r := NewRecord(testTime, InfoLevel, "message", 1, nil)
+ r := NewRecord(testTime, LevelInfo, "message", 1, nil)
r.AddAttrs(test.attrs...)
var buf bytes.Buffer
opts := HandlerOptions{ReplaceAttr: test.replace}
@@ -355,14 +355,14 @@
want bool
}{
{nil, true},
- {WarnLevel, false},
+ {LevelWarn, false},
{&LevelVar{}, true}, // defaults to Info
- {levelVar(WarnLevel), false},
- {DebugLevel, true},
- {levelVar(DebugLevel), true},
+ {levelVar(LevelWarn), false},
+ {LevelDebug, true},
+ {levelVar(LevelDebug), true},
} {
h := &commonHandler{opts: HandlerOptions{Level: test.leveler}}
- got := h.enabled(InfoLevel)
+ got := h.enabled(LevelInfo)
if got != test.want {
t.Errorf("%v: got %t, want %t", test.leveler, got, test.want)
}
diff --git a/slog/json_handler_test.go b/slog/json_handler_test.go
index ef3be9b..635d534 100644
--- a/slog/json_handler_test.go
+++ b/slog/json_handler_test.go
@@ -39,7 +39,7 @@
t.Run(test.name, func(t *testing.T) {
var buf bytes.Buffer
h := test.opts.NewJSONHandler(&buf)
- r := NewRecord(testTime, InfoLevel, "m", 0, nil)
+ r := NewRecord(testTime, LevelInfo, "m", 0, nil)
r.AddAttrs(Int("a", 1), Any("m", map[string]int{"b": 2}))
if err := h.Handle(r); err != nil {
t.Fatal(err)
@@ -103,7 +103,7 @@
{math.NaN(), `"NaN"`},
{math.Inf(+1), `"+Inf"`},
{math.Inf(-1), `"-Inf"`},
- {WarnLevel, `"WARN"`},
+ {LevelWarn, `"WARN"`},
} {
got := jsonValueString(t, AnyValue(test.value))
if got != test.want {
@@ -162,7 +162,7 @@
b.ReportAllocs()
b.ResetTimer()
for i := 0; i < b.N; i++ {
- l.LogAttrs(InfoLevel, "this is a typical log message",
+ l.LogAttrs(LevelInfo, "this is a typical log message",
String("module", "github.com/google/go-cmp"),
String("version", "v1.23.4"),
Int("count", 23),
@@ -223,7 +223,7 @@
b.ReportAllocs()
b.ResetTimer()
for i := 0; i < b.N; i++ {
- l.LogAttrs(InfoLevel, "this is a typical log message",
+ l.LogAttrs(LevelInfo, "this is a typical log message",
String("module", "github.com/google/go-cmp"),
String("version", "v1.23.4"),
Int("count", 23),
diff --git a/slog/level.go b/slog/level.go
index c613cf9..f6588de 100644
--- a/slog/level.go
+++ b/slog/level.go
@@ -40,10 +40,10 @@
//
// Names for common levels.
const (
- DebugLevel Level = -4
- InfoLevel Level = 0
- WarnLevel Level = 4
- ErrorLevel Level = 8
+ LevelDebug Level = -4
+ LevelInfo Level = 0
+ LevelWarn Level = 4
+ LevelError Level = 8
)
// String returns a name for the level.
@@ -53,8 +53,8 @@
// an integer is appended to the uppercased name.
// Examples:
//
-// WarnLevel.String() => "WARN"
-// (WarnLevel-2).String() => "WARN-2"
+// LevelWarn.String() => "WARN"
+// (LevelWarn-2).String() => "WARN-2"
func (l Level) String() string {
str := func(base string, val Level) string {
if val == 0 {
@@ -64,14 +64,14 @@
}
switch {
- case l < InfoLevel:
- return str("DEBUG", l-DebugLevel)
- case l < WarnLevel:
- return str("INFO", l-InfoLevel)
- case l < ErrorLevel:
- return str("WARN", l-WarnLevel)
+ case l < LevelInfo:
+ return str("DEBUG", l-LevelDebug)
+ case l < LevelWarn:
+ return str("INFO", l-LevelInfo)
+ case l < LevelError:
+ return str("WARN", l-LevelWarn)
default:
- return str("ERROR", l-ErrorLevel)
+ return str("ERROR", l-LevelError)
}
}
@@ -90,7 +90,7 @@
// dynamically.
// It implements Leveler as well as a Set method,
// and it is safe for use by multiple goroutines.
-// The zero LevelVar corresponds to InfoLevel.
+// The zero LevelVar corresponds to LevelInfo.
type LevelVar struct {
val atomic.Int64
}
diff --git a/slog/level_test.go b/slog/level_test.go
index d85de39..833ef3e 100644
--- a/slog/level_test.go
+++ b/slog/level_test.go
@@ -14,16 +14,16 @@
want string
}{
{0, "INFO"},
- {ErrorLevel, "ERROR"},
- {ErrorLevel + 2, "ERROR+2"},
- {ErrorLevel - 2, "WARN+2"},
- {WarnLevel, "WARN"},
- {WarnLevel - 1, "INFO+3"},
- {InfoLevel, "INFO"},
- {InfoLevel + 1, "INFO+1"},
- {InfoLevel - 3, "DEBUG+1"},
- {DebugLevel, "DEBUG"},
- {DebugLevel - 2, "DEBUG-2"},
+ {LevelError, "ERROR"},
+ {LevelError + 2, "ERROR+2"},
+ {LevelError - 2, "WARN+2"},
+ {LevelWarn, "WARN"},
+ {LevelWarn - 1, "INFO+3"},
+ {LevelInfo, "INFO"},
+ {LevelInfo + 1, "INFO+1"},
+ {LevelInfo - 3, "DEBUG+1"},
+ {LevelDebug, "DEBUG"},
+ {LevelDebug - 2, "DEBUG-2"},
} {
got := test.in.String()
if got != test.want {
@@ -34,15 +34,15 @@
func TestLevelVar(t *testing.T) {
var al LevelVar
- if got, want := al.Level(), InfoLevel; got != want {
+ if got, want := al.Level(), LevelInfo; got != want {
t.Errorf("got %v, want %v", got, want)
}
- al.Set(WarnLevel)
- if got, want := al.Level(), WarnLevel; got != want {
+ al.Set(LevelWarn)
+ if got, want := al.Level(), LevelWarn; got != want {
t.Errorf("got %v, want %v", got, want)
}
- al.Set(InfoLevel)
- if got, want := al.Level(), InfoLevel; got != want {
+ al.Set(LevelInfo)
+ if got, want := al.Level(), LevelInfo; got != want {
t.Errorf("got %v, want %v", got, want)
}
diff --git a/slog/logger.go b/slog/logger.go
index cffc23c..3707a10 100644
--- a/slog/logger.go
+++ b/slog/logger.go
@@ -22,7 +22,7 @@
// SetDefault makes l the default Logger.
// After this call, output from the log package's default Logger
-// (as with [log.Print], etc.) will be logged at InfoLevel using l's Handler.
+// (as with [log.Print], etc.) will be logged at LevelInfo using l's Handler.
func SetDefault(l *Logger) {
defaultLogger.Store(l)
// If the default's handler is a defaultHandler, then don't use a handleWriter,
@@ -54,7 +54,7 @@
if len(buf) > 0 && buf[len(buf)-1] == '\n' {
buf = buf[:len(buf)-1]
}
- r := NewRecord(time.Now(), InfoLevel, string(buf), depth, nil)
+ r := NewRecord(time.Now(), LevelInfo, string(buf), depth, nil)
return origLen, w.h.Handle(r)
}
@@ -186,46 +186,46 @@
_ = l.Handler().Handle(r)
}
-// Debug logs at DebugLevel.
+// Debug logs at LevelDebug.
func (l *Logger) Debug(msg string, args ...any) {
- l.LogDepth(0, DebugLevel, msg, args...)
+ l.LogDepth(0, LevelDebug, msg, args...)
}
-// Info logs at InfoLevel.
+// Info logs at LevelInfo.
func (l *Logger) Info(msg string, args ...any) {
- l.LogDepth(0, InfoLevel, msg, args...)
+ l.LogDepth(0, LevelInfo, msg, args...)
}
-// Warn logs at WarnLevel.
+// Warn logs at LevelWarn.
func (l *Logger) Warn(msg string, args ...any) {
- l.LogDepth(0, WarnLevel, msg, args...)
+ l.LogDepth(0, LevelWarn, msg, args...)
}
-// Error logs at ErrorLevel.
+// Error logs at LevelError.
// If err is non-nil, Error appends Any(ErrorKey, err)
// to the list of attributes.
func (l *Logger) Error(msg string, err error, args ...any) {
- l.logDepthErr(err, 0, ErrorLevel, msg, args...)
+ l.logDepthErr(err, 0, LevelError, msg, args...)
}
// Debug calls Logger.Debug on the default logger.
func Debug(msg string, args ...any) {
- Default().LogDepth(0, DebugLevel, msg, args...)
+ Default().LogDepth(0, LevelDebug, msg, args...)
}
// Info calls Logger.Info on the default logger.
func Info(msg string, args ...any) {
- Default().LogDepth(0, InfoLevel, msg, args...)
+ Default().LogDepth(0, LevelInfo, msg, args...)
}
// Warn calls Logger.Warn on the default logger.
func Warn(msg string, args ...any) {
- Default().LogDepth(0, WarnLevel, msg, args...)
+ Default().LogDepth(0, LevelWarn, msg, args...)
}
// Error calls Logger.Error on the default logger.
func Error(msg string, err error, args ...any) {
- Default().logDepthErr(err, 0, ErrorLevel, msg, args...)
+ Default().logDepthErr(err, 0, LevelError, msg, args...)
}
// Log calls Logger.Log on the default logger.
diff --git a/slog/logger_test.go b/slog/logger_test.go
index 0a50510..4a8bb4f 100644
--- a/slog/logger_test.go
+++ b/slog/logger_test.go
@@ -46,10 +46,10 @@
l.Error("bad", io.EOF, "a", 1)
check(`level=ERROR msg=bad a=1 err=EOF`)
- l.Log(WarnLevel+1, "w", Int("a", 1), String("b", "two"))
+ l.Log(LevelWarn+1, "w", Int("a", 1), String("b", "two"))
check(`level=WARN\+1 msg=w a=1 b=two`)
- l.LogAttrs(InfoLevel+1, "a b c", Int("a", 1), String("b", "two"))
+ l.LogAttrs(LevelInfo+1, "a b c", Int("a", 1), String("b", "two"))
check(`level=INFO\+1 msg="a b c" a=1 b=two`)
l.Info("info", "a", []Attr{Int("i", 1)})
@@ -168,9 +168,9 @@
startLine = f.Line + 4
// Do not change the number of lines between here and the call to check(0).
- logger.Log(InfoLevel, "")
+ logger.Log(LevelInfo, "")
check(0)
- logger.LogAttrs(InfoLevel, "")
+ logger.LogAttrs(LevelInfo, "")
check(1)
logger.Debug("")
check(2)
@@ -188,9 +188,9 @@
check(8)
Error("", nil)
check(9)
- Log(InfoLevel, "")
+ Log(LevelInfo, "")
check(10)
- LogAttrs(InfoLevel, "")
+ LogAttrs(LevelInfo, "")
check(11)
}
@@ -209,7 +209,7 @@
wantAllocs(t, 0, func() { dl.Info("hello") })
})
t.Run("logger.Log", func(t *testing.T) {
- wantAllocs(t, 0, func() { dl.Log(DebugLevel, "hello") })
+ wantAllocs(t, 0, func() { dl.Log(LevelDebug, "hello") })
})
t.Run("2 pairs", func(t *testing.T) {
s := "abc"
@@ -226,7 +226,7 @@
s := "abc"
i := 2000
wantAllocs(t, 2, func() {
- l.Log(InfoLevel, "hello",
+ l.Log(LevelInfo, "hello",
"n", i,
"s", s,
)
@@ -237,8 +237,8 @@
s := "abc"
i := 2000
wantAllocs(t, 0, func() {
- if l.Enabled(InfoLevel) {
- l.Log(InfoLevel, "hello",
+ if l.Enabled(LevelInfo) {
+ l.Log(LevelInfo, "hello",
"n", i,
"s", s,
)
@@ -260,30 +260,30 @@
wantAllocs(t, 0, func() { dl.Info("", "error", io.EOF) })
})
t.Run("attrs1", func(t *testing.T) {
- wantAllocs(t, 0, func() { dl.LogAttrs(InfoLevel, "", Int("a", 1)) })
- wantAllocs(t, 0, func() { dl.LogAttrs(InfoLevel, "", Any("error", io.EOF)) })
+ wantAllocs(t, 0, func() { dl.LogAttrs(LevelInfo, "", Int("a", 1)) })
+ wantAllocs(t, 0, func() { dl.LogAttrs(LevelInfo, "", Any("error", io.EOF)) })
})
t.Run("attrs3", func(t *testing.T) {
wantAllocs(t, 0, func() {
- dl.LogAttrs(InfoLevel, "hello", Int("a", 1), String("b", "two"), Duration("c", time.Second))
+ dl.LogAttrs(LevelInfo, "hello", Int("a", 1), String("b", "two"), Duration("c", time.Second))
})
})
t.Run("attrs3 disabled", func(t *testing.T) {
logger := New(discardHandler{disabled: true})
wantAllocs(t, 0, func() {
- logger.LogAttrs(InfoLevel, "hello", Int("a", 1), String("b", "two"), Duration("c", time.Second))
+ logger.LogAttrs(LevelInfo, "hello", Int("a", 1), String("b", "two"), Duration("c", time.Second))
})
})
t.Run("attrs6", func(t *testing.T) {
wantAllocs(t, 1, func() {
- dl.LogAttrs(InfoLevel, "hello",
+ dl.LogAttrs(LevelInfo, "hello",
Int("a", 1), String("b", "two"), Duration("c", time.Second),
Int("d", 1), String("e", "two"), Duration("f", time.Second))
})
})
t.Run("attrs9", func(t *testing.T) {
wantAllocs(t, 1, func() {
- dl.LogAttrs(InfoLevel, "hello",
+ dl.LogAttrs(LevelInfo, "hello",
Int("a", 1), String("b", "two"), Duration("c", time.Second),
Int("d", 1), String("e", "two"), Duration("f", time.Second),
Int("d", 1), String("e", "two"), Duration("f", time.Second))
@@ -421,34 +421,34 @@
b.Run("attrs", func(b *testing.B) {
b.ReportAllocs()
for i := 0; i < b.N; i++ {
- l.LogAttrs(InfoLevel, "msg", Int("a", 1), String("b", "two"), Bool("c", true))
+ l.LogAttrs(LevelInfo, "msg", Int("a", 1), String("b", "two"), Bool("c", true))
}
})
b.Run("attrs-parallel", func(b *testing.B) {
b.ReportAllocs()
b.RunParallel(func(pb *testing.PB) {
for pb.Next() {
- l.LogAttrs(InfoLevel, "msg", Int("a", 1), String("b", "two"), Bool("c", true))
+ l.LogAttrs(LevelInfo, "msg", Int("a", 1), String("b", "two"), Bool("c", true))
}
})
})
b.Run("keys-values", func(b *testing.B) {
b.ReportAllocs()
for i := 0; i < b.N; i++ {
- l.Log(InfoLevel, "msg", "a", 1, "b", "two", "c", true)
+ l.Log(LevelInfo, "msg", "a", 1, "b", "two", "c", true)
}
})
b.Run("WithContext", func(b *testing.B) {
b.ReportAllocs()
for i := 0; i < b.N; i++ {
- l.WithContext(ctx).LogAttrs(InfoLevel, "msg2", Int("a", 1), String("b", "two"), Bool("c", true))
+ l.WithContext(ctx).LogAttrs(LevelInfo, "msg2", Int("a", 1), String("b", "two"), Bool("c", true))
}
})
b.Run("WithContext-parallel", func(b *testing.B) {
b.ReportAllocs()
b.RunParallel(func(pb *testing.PB) {
for pb.Next() {
- l.WithContext(ctx).LogAttrs(InfoLevel, "msg", Int("a", 1), String("b", "two"), Bool("c", true))
+ l.WithContext(ctx).LogAttrs(LevelInfo, "msg", Int("a", 1), String("b", "two"), Bool("c", true))
}
})
})
@@ -458,7 +458,7 @@
defer SetDefault(dl)
b.ReportAllocs()
for i := 0; i < b.N; i++ {
- Ctx(ctx).LogAttrs(InfoLevel, "msg", Int("a", 1), String("b", "two"), Bool("c", true))
+ Ctx(ctx).LogAttrs(LevelInfo, "msg", Int("a", 1), String("b", "two"), Bool("c", true))
}
})
}
diff --git a/slog/record_test.go b/slog/record_test.go
index 78ebf46..1531254 100644
--- a/slog/record_test.go
+++ b/slog/record_test.go
@@ -90,7 +90,7 @@
}
func newRecordWithAttrs(as []Attr) Record {
- r := NewRecord(time.Now(), InfoLevel, "", 0, nil)
+ r := NewRecord(time.Now(), LevelInfo, "", 0, nil)
r.AddAttrs(as...)
return r
}
@@ -117,7 +117,7 @@
}
func BenchmarkSourceLine(b *testing.B) {
- r := NewRecord(time.Now(), InfoLevel, "", 5, nil)
+ r := NewRecord(time.Now(), LevelInfo, "", 5, nil)
b.Run("alone", func(b *testing.B) {
for i := 0; i < b.N; i++ {
file, line := r.SourceLine()
@@ -144,7 +144,7 @@
var a Attr
for i := 0; i < b.N; i++ {
- r := NewRecord(time.Time{}, InfoLevel, "", 0, nil)
+ r := NewRecord(time.Time{}, LevelInfo, "", 0, nil)
for j := 0; j < nAttrs; j++ {
r.AddAttrs(Int("k", j))
}
diff --git a/slog/text_handler_test.go b/slog/text_handler_test.go
index 2e4dcc2..47fe2b0 100644
--- a/slog/text_handler_test.go
+++ b/slog/text_handler_test.go
@@ -72,7 +72,7 @@
t.Run(opts.name, func(t *testing.T) {
var buf bytes.Buffer
h := opts.opts.NewTextHandler(&buf)
- r := NewRecord(testTime, InfoLevel, "a message", 0, nil)
+ r := NewRecord(testTime, LevelInfo, "a message", 0, nil)
r.AddAttrs(test.attr)
if err := h.Handle(r); err != nil {
t.Fatal(err)
@@ -114,7 +114,7 @@
func TestTextHandlerSource(t *testing.T) {
var buf bytes.Buffer
h := HandlerOptions{AddSource: true}.NewTextHandler(&buf)
- r := NewRecord(testTime, InfoLevel, "m", 2, nil)
+ r := NewRecord(testTime, LevelInfo, "m", 2, nil)
if err := h.Handle(r); err != nil {
t.Fatal(err)
}
@@ -155,7 +155,7 @@
}
func TestTextHandlerAlloc(t *testing.T) {
- r := NewRecord(time.Now(), InfoLevel, "msg", 0, nil)
+ r := NewRecord(time.Now(), LevelInfo, "msg", 0, nil)
for i := 0; i < 10; i++ {
r.AddAttrs(Int("x = y", i))
}
diff --git a/slog/value_test.go b/slog/value_test.go
index 7de63bd..f3b0db3 100644
--- a/slog/value_test.go
+++ b/slog/value_test.go
@@ -110,13 +110,13 @@
// Because typical Levels are small integers,
// they are zero-alloc.
var a Value
- x := DebugLevel + 100
+ x := LevelDebug + 100
wantAllocs(t, 0, func() { a = AnyValue(x) })
_ = a
}
func TestAnyLevel(t *testing.T) {
- x := DebugLevel + 100
+ x := LevelDebug + 100
v := AnyValue(x)
vv := v.Any()
if _, ok := vv.(Level); !ok {