slog: remove disableSourceLine
Remove an obsolete way of disabling PC fetching for benchmarks.
Now we do it with the nopc build tag.
Change-Id: I7e6666ed1692ccf08388ea697a8a03b3e4149703
Reviewed-on: https://go-review.googlesource.com/c/exp/+/442358
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
diff --git a/slog/logger.go b/slog/logger.go
index a812579..13fffb5 100644
--- a/slog/logger.go
+++ b/slog/logger.go
@@ -126,16 +126,8 @@
_ = l.Handler().Handle(r)
}
-var useSourceLine = true
-
-// Temporary, for benchmarking.
-// Eventually, getting the pc should be fast.
-func disableSourceLine() { useSourceLine = false }
-
func (l *Logger) makeRecord(msg string, level Level, depth int) Record {
- if useSourceLine {
- depth += 5
- }
+ depth += 5
return NewRecord(time.Now(), level, msg, depth)
}
diff --git a/slog/logger_test.go b/slog/logger_test.go
index 94d9c94..48cd0bd 100644
--- a/slog/logger_test.go
+++ b/slog/logger_test.go
@@ -334,7 +334,6 @@
// This is a simple benchmark. See the benchmarks subdirectory for more extensive ones.
func BenchmarkNopLog(b *testing.B) {
b.ReportAllocs()
- disableSourceLine()
l := New(&captureHandler{})
b.Run("attrs", func(b *testing.B) {
for i := 0; i < b.N; i++ {