Skip to content

Commit

Permalink
chore: reduce event types
Browse files Browse the repository at this point in the history
  • Loading branch information
marcsauter committed Jan 7, 2025
1 parent a41e4c6 commit 5ac6d06
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
9 changes: 3 additions & 6 deletions eventhandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ type EventType int

// Event types
const (
DebugEvent = iota
InfoEvent
InfoEvent = iota
ErrorEvent
)

Expand All @@ -25,12 +24,10 @@ func DefaultEventHandler() EventHandler {

return func(eventType EventType, msg string, args ...any) {
switch eventType {
case DebugEvent:
l.Debug(msg, args...)
case InfoEvent:
l.Info(msg, args...)
case ErrorEvent:
l.Error(msg, args...)
default:
l.Info(msg, args...)
}
}
}
6 changes: 2 additions & 4 deletions profiler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,10 @@ func testEventHandler(w io.Writer, mu *sync.Mutex) profiler.EventHandler {
defer mu.Unlock()

switch eventType {
case profiler.DebugEvent:
l.Debug(msg, args...)
case profiler.InfoEvent:
l.Info(msg, args...)
case profiler.ErrorEvent:
l.Error(msg, args...)
default:
l.Info(msg, args...)
}
}
}
Expand Down

0 comments on commit 5ac6d06

Please sign in to comment.