blob: 2e5f524588b4c762c107d16546d676e7c33b10d6 [file] [log] [blame]
gio183e8342024-08-20 06:01:24 +04001package main
2
3import (
4 "strings"
5 "sync"
6)
7
8type Log struct {
9 l sync.Mutex
10 d strings.Builder
11}
12
13func (l *Log) Write(p []byte) (n int, err error) {
14 l.l.Lock()
15 defer l.l.Unlock()
16 // TODO(gio): Reset s.logs periodically
17 return l.d.Write(p)
18}
19
20func (l *Log) Contents() string {
21 l.l.Lock()
22 defer l.l.Unlock()
23 return l.d.String()
24}