feat(confg): reload on save and refactor logging (#275)

* feat(confg): reload on save

* refactor(logging): rework
This commit is contained in:
Ludvig Lundgren 2022-05-20 09:27:01 +02:00 committed by GitHub
parent 198528a474
commit 91b094f4f4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
56 changed files with 995 additions and 873 deletions

View file

@ -6,19 +6,17 @@ import (
"github.com/autobrr/autobrr/internal/domain"
"github.com/autobrr/autobrr/pkg/sonarr"
"github.com/rs/zerolog/log"
)
func (s *service) sonarr(release domain.Release, action domain.Action) ([]string, error) {
log.Trace().Msg("action SONARR")
s.log.Trace().Msg("action SONARR")
// TODO validate data
// get client for action
client, err := s.clientSvc.FindByID(context.TODO(), action.ClientID)
if err != nil {
log.Error().Err(err).Msgf("sonarr: error finding client: %v", action.ClientID)
s.log.Error().Err(err).Msgf("sonarr: error finding client: %v", action.ClientID)
return nil, err
}
@ -54,17 +52,17 @@ func (s *service) sonarr(release domain.Release, action domain.Action) ([]string
rejections, err := arr.Push(r)
if err != nil {
log.Error().Stack().Err(err).Msgf("sonarr: failed to push release: %v", r)
s.log.Error().Stack().Err(err).Msgf("sonarr: failed to push release: %v", r)
return nil, err
}
if rejections != nil {
log.Debug().Msgf("sonarr: release push rejected: %v, indexer %v to %v reasons: '%v'", r.Title, r.Indexer, client.Host, rejections)
s.log.Debug().Msgf("sonarr: release push rejected: %v, indexer %v to %v reasons: '%v'", r.Title, r.Indexer, client.Host, rejections)
return rejections, nil
}
log.Debug().Msgf("sonarr: successfully pushed release: %v, indexer %v to %v", r.Title, r.Indexer, client.Host)
s.log.Debug().Msgf("sonarr: successfully pushed release: %v, indexer %v to %v", r.Title, r.Indexer, client.Host)
return nil, nil
}