MCPcopy Create free account
hub / github.com/easyp-tech/server / trace

Method trace

internal/providers/localgit/localgit.go:239–246  ·  view source on GitHub ↗

trace emits a structured log line carrying the per-request correlation id when one is present in the context. localgit does not own a logger because store is constructed without one; the only context available is the request context, so the line is a no-op when there is no request id. The point of t

(ctx context.Context, level slog.Level, msg string, attrs ...slog.Attr)

Source from the content-addressed store, hash-verified

237// point of these traces is to surface in prod logs (which include request_id)
238// when a per-request log line names a slow localgit call.
239func (r sourceRepo) trace(ctx context.Context, level slog.Level, msg string, attrs ...slog.Attr) {
240 id := reqid.From(ctx)
241 if id == "" {
242 return
243 }
244 base := []slog.Attr{slog.String("request_id", id)}
245 slog.Default().LogAttrs(ctx, level, msg, append(base, attrs...)...)
246}
247
248func fileBytes(files []content.File) int {
249 n := 0

Callers 2

GetMetaMethod · 0.95
GetFilesMethod · 0.95

Calls 2

FromFunction · 0.92
StringMethod · 0.45

Tested by

no test coverage detected