MCPcopy Index your code
hub / github.com/rilldata/rill / AddEntry

Method AddEntry

runtime/pkg/logbuffer/buffer.go:30–50  ·  view source on GitHub ↗
(lvl runtimev1.LogLevel, t time.Time, msg, payload string)

Source from the content-addressed store, hash-verified

28}
29
30func (b *Buffer) AddEntry(lvl runtimev1.LogLevel, t time.Time, msg, payload string) error {
31 message := &runtimev1.Log{
32 Level: lvl,
33 Time: timestamppb.New(t),
34 Message: msg,
35 JsonPayload: payload,
36 }
37
38 b.mu.Lock()
39 defer b.mu.Unlock()
40
41 b.messages.Push(bufferutil.Item[*runtimev1.Log]{
42 Value: message,
43 Size: len(payload) + len(msg) + 8 + 12, // enum size (assuming upper bound for 64 bits system) + proto Timestamp size
44 })
45
46 for client := range b.clients {
47 client <- message
48 }
49 return nil
50}
51
52func (b *Buffer) WatchLogs(ctx context.Context, fn LogCallback, minLvl runtimev1.LogLevel) error {
53 messageChannel := make(chan *runtimev1.Log)

Callers 1

WriteMethod · 0.80

Calls 3

LockMethod · 0.45
UnlockMethod · 0.45
PushMethod · 0.45

Tested by

no test coverage detected