Share source evidence through the selected capture sink
This commit is contained in:
@@ -20,6 +20,12 @@ type DebugRecorder interface {
|
||||
|
||||
type noopDebugRecorder struct{}
|
||||
|
||||
// evidenceDebugRecorder adapts the selected caller-owned evidence sink without
|
||||
// adding synchronization; explicit writers own their concurrent-call safety.
|
||||
type evidenceDebugRecorder struct{ contracts.EvidenceWriter }
|
||||
|
||||
func (evidenceDebugRecorder) Enabled() bool { return true }
|
||||
|
||||
func NoopDebugRecorder() DebugRecorder { return noopDebugRecorder{} }
|
||||
|
||||
func (noopDebugRecorder) Enabled() bool { return false }
|
||||
@@ -110,7 +116,10 @@ func writeDebugTimed(recorder DebugRecorder, name string, envelope debugTimedEnv
|
||||
if envelope.DurationMS == 0 {
|
||||
envelope.DurationMS = envelope.CompletedAt.Sub(envelope.StartedAt).Milliseconds()
|
||||
}
|
||||
return recorder.WriteJSON(name, envelope)
|
||||
if err := recorder.WriteJSON(name, envelope); err != nil {
|
||||
return &contracts.CaptureError{Cause: err}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func debugContentEnvelope(content []byte, mediaType string, metadata map[string]any, _ any) debugBinaryEnvelope {
|
||||
|
||||
Reference in New Issue
Block a user