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

@ -10,9 +10,9 @@ import (
"github.com/autobrr/autobrr/internal/announce"
"github.com/autobrr/autobrr/internal/domain"
"github.com/autobrr/autobrr/internal/logger"
"github.com/autobrr/autobrr/internal/notification"
"github.com/autobrr/autobrr/internal/release"
"github.com/autobrr/autobrr/pkg/errors"
"github.com/avast/retry-go"
"github.com/dcarbone/zadapters/zstdlog"
@ -80,7 +80,7 @@ type Handler struct {
authenticated bool
}
func NewHandler(log logger.Logger, network domain.IrcNetwork, definitions []*domain.IndexerDefinition, releaseSvc release.Service, notificationSvc notification.Service) *Handler {
func NewHandler(log zerolog.Logger, network domain.IrcNetwork, definitions []*domain.IndexerDefinition, releaseSvc release.Service, notificationSvc notification.Service) *Handler {
h := &Handler{
log: log.With().Str("network", network.Server).Logger(),
client: nil,
@ -550,7 +550,7 @@ func (h *Handler) sendToAnnounceProcessor(channel string, msg string) error {
// check if queue exists
queue, ok := h.announceProcessors[channel]
if !ok {
return fmt.Errorf("queue '%v' not found", channel)
return errors.New("queue '%v' not found", channel)
}
// if it exists, add msg