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:
Ludvig Lundgren 2022-07-05 13:31:44 +02:00 committed by GitHub
parent 95471a4cf7
commit 0e88117702
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
69 changed files with 1172 additions and 957 deletions

View file

@ -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)
}