@@ -87,6 +87,7 @@ type simpleLogger struct {
8787// a clock-like spam rate limiter
8888// maps level+pc to its age in ticks
8989type clock struct {
90+ sync.Mutex
9091 l2 [NONE + 1 ][pcbuckets ]uint8 // level+pc clock
9192 l1 [NONE + 1 ]uint8 // level clock
9293}
@@ -120,7 +121,10 @@ var _ Logger = (*simpleLogger)(nil)
120121// const logcatLineSize = 1024
121122
122123// qSize is the number of recent log msgs to keep in the ring buffer.
123- const qSize = 128
124+ const qSize = 256
125+
126+ // consoleChSize is the size of the console channel.
127+ const consoleChSize = 256
124128
125129// similarTraceThreshold is the no. of similar stacktraces to report before suppressing.
126130const similarTraceThreshold = 8
@@ -388,7 +392,7 @@ func (l *simpleLogger) err(at int, msg string) {
388392}
389393
390394func caller (at int ) (pc uintptr , who string ) {
391- pc , file , line , _ := runtime .Caller (at + 1 )
395+ pc , file , line , _ := runtime .Caller (at )
392396 if len (file ) <= 0 {
393397 file = "???"
394398 } else {
@@ -437,6 +441,10 @@ func (l *simpleLogger) writelog(lvl LogLevel, at int, msg string, args ...any) {
437441// not thread-safe for performance reasons
438442// go.dev/play/p/6CkoACJ1bYz
439443func (l * simpleLogger ) spammy (lvl LogLevel , pc uintptr ) (y bool ) {
444+ // expensive, but golog's internal logger also grabs a mutex before every write
445+ l .clock .Lock ()
446+ defer l .clock .Unlock ()
447+
440448 l .clock .l1 [lvl ]++ // tick the level clock
441449 t := l .clock .l1 [lvl ]
442450
0 commit comments