mirror of
https://github.com/idanoo/autobrr
synced 2025-07-22 16:29:12 +00:00
feat(logging); improve messages and errors (#336)
* feat(logger): add module context * feat(logger): change errors package * feat(logger): update tests
This commit is contained in:
parent
95471a4cf7
commit
0e88117702
69 changed files with 1172 additions and 957 deletions
|
@ -9,10 +9,11 @@ import (
|
|||
"github.com/autobrr/autobrr/internal/release"
|
||||
|
||||
"github.com/asaskevich/EventBus"
|
||||
"github.com/rs/zerolog"
|
||||
)
|
||||
|
||||
type Subscriber struct {
|
||||
log logger.Logger
|
||||
log zerolog.Logger
|
||||
eventbus EventBus.Bus
|
||||
notificationSvc notification.Service
|
||||
releaseSvc release.Service
|
||||
|
@ -20,7 +21,7 @@ type Subscriber struct {
|
|||
|
||||
func NewSubscribers(log logger.Logger, eventbus EventBus.Bus, notificationSvc notification.Service, releaseSvc release.Service) Subscriber {
|
||||
s := Subscriber{
|
||||
log: log,
|
||||
log: log.With().Str("module", "events").Logger(),
|
||||
eventbus: eventbus,
|
||||
notificationSvc: notificationSvc,
|
||||
releaseSvc: releaseSvc,
|
||||
|
@ -55,7 +56,7 @@ func (s Subscriber) releasePushStatus(actionStatus *domain.ReleaseActionStatus)
|
|||
}
|
||||
|
||||
func (s Subscriber) sendNotification(event *domain.NotificationEvent, payload *domain.NotificationPayload) {
|
||||
s.log.Trace().Msgf("events: '%v' '%+v'", event, payload)
|
||||
s.log.Trace().Msgf("events: '%v' '%+v'", *event, payload)
|
||||
|
||||
s.notificationSvc.Send(*event, *payload)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue