Skip to content

Commit c96df5b

Browse files
committed
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>
1 parent a3968a4 commit c96df5b

File tree

2 files changed

+1
-10
lines changed

2 files changed

+1
-10
lines changed

slog/logger.go

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -126,16 +126,8 @@ func (l *Logger) LogDepth(calldepth int, level Level, msg string, args ...any) {
126126
_ = l.Handler().Handle(r)
127127
}
128128

129-
var useSourceLine = true
130-
131-
// Temporary, for benchmarking.
132-
// Eventually, getting the pc should be fast.
133-
func disableSourceLine() { useSourceLine = false }
134-
135129
func (l *Logger) makeRecord(msg string, level Level, depth int) Record {
136-
if useSourceLine {
137-
depth += 5
138-
}
130+
depth += 5
139131
return NewRecord(time.Now(), level, msg, depth)
140132
}
141133

slog/logger_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,6 @@ func (h discardHandler) WithScope(name string) Handler {
334334
// This is a simple benchmark. See the benchmarks subdirectory for more extensive ones.
335335
func BenchmarkNopLog(b *testing.B) {
336336
b.ReportAllocs()
337-
disableSourceLine()
338337
l := New(&captureHandler{})
339338
b.Run("attrs", func(b *testing.B) {
340339
for i := 0; i < b.N; i++ {

0 commit comments

Comments
 (0)