Skip to content

Commit

Permalink
fix(): added a function to add project name in recorder (#19)
Browse files Browse the repository at this point in the history
Signed-off-by: Puran Adhikari <[email protected]>
  • Loading branch information
PuranAdhikari authored Mar 20, 2023
1 parent 82baf58 commit d8419d1
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkg/events/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ type EventRecorder interface {
WithSlice(string) EventRecorder
// WithNamespace returns a new recorder with namespace name added
WithNamespace(string) EventRecorder
// WithProject returns a new recorder with project name added
WithProject(string) EventRecorder
}

func NewEventRecorder(c client.Writer, s *runtime.Scheme, o EventRecorderOptions) EventRecorder {
Expand Down Expand Up @@ -116,6 +118,13 @@ func (er *eventRecorder) WithNamespace(ns string) EventRecorder {
return e
}

// WithProject returns a new recorder with added project name
func (er *eventRecorder) WithProject(project string) EventRecorder {
e := er.Copy()
e.Options.Project = project
return e
}

// RecordEvent raises a new event with the given fields
// TODO: events caching and aggregation
func (er *eventRecorder) RecordEvent(ctx context.Context, e *Event) error {
Expand Down

0 comments on commit d8419d1

Please sign in to comment.