MCPcopy Create free account
hub / github.com/PostHog/duckgres / Handle

Method Handle

cmd/cache-proxy/main.go:44–58  ·  view source on GitHub ↗
(_ context.Context, r slog.Record)

Source from the content-addressed store, hash-verified

42 stamp []slog.Attr
43}
44
45func (h *stampedHandler) Enabled(_ context.Context, l slog.Level) bool {
46 return l >= h.level
47}
48
49func (h *stampedHandler) Handle(_ context.Context, r slog.Record) error {
50 var b strings.Builder
51 fmt.Fprintf(&b, "time=%s level=%s", r.Time.UTC().Format(time.RFC3339Nano), r.Level.String())
52 for _, a := range h.stamp {
53 fmt.Fprintf(&b, " %s=%s", a.Key, a.Value.String())
54 }
55 fmt.Fprintf(&b, " msg=%q", r.Message)
56 r.Attrs(func(a slog.Attr) bool {
57 fmt.Fprintf(&b, " %s=%s", a.Key, a.Value.String())
58 return true
59 })
60 b.WriteByte('\n')
61 _, err := io.WriteString(h.out, b.String())

Callers 2

mainFunction · 0.45

Calls 1

StringMethod · 0.45

Tested by 1