Skip to content

Commit

Permalink
adding logging if event published with 0 listeners
Browse files Browse the repository at this point in the history
  • Loading branch information
fwidjaya20 committed Dec 16, 2023
1 parent 7ab44db commit 83a9c78
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions event/bus.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ func (b *Bus) Publish() error {
b.locker.Lock()
defer b.locker.Unlock()

if len(b.listeners) == 0 {
b.logger.Infof("event %s doesn't bind any listeners", b.event.Signature())
}

return b.driver.Publish()
}

Expand Down

0 comments on commit 83a9c78

Please sign in to comment.