feat: activity log backend foundation

This commit is contained in:
fsylvain committed 2026-10-06 20:35:03 +02:00
1 parent 8907bb49fe
commit 50b1649965
74 files changed
+5949 -239

No files matched your search

+31
View File
@@ -0,0 +1,31 @@
package audit
import "context"
type Recorder interface {
Record(ctx context.Context, event Event)
}
type discardRecorder struct{}
func (discardRecorder) Record(context.Context, Event) {}
var Discard Recorder = discardRecorder{}
type Origin struct {
Actor Actor
Source Source
IP string
UserAgent string
}
type originContextKey struct{}
func WithOrigin(ctx context.Context, origin Origin) context.Context {
return context.WithValue(ctx, originContextKey{}, origin)
}
func OriginFrom(ctx context.Context) (Origin, bool) {
origin, ok := ctx.Value(originContextKey{}).(Origin)
return origin, ok
}