mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 08:49:13 +00:00
feat(confg): reload on save and refactor logging (#275)
* feat(confg): reload on save * refactor(logging): rework
This commit is contained in:
parent
198528a474
commit
91b094f4f4
56 changed files with 995 additions and 873 deletions
|
@ -7,19 +7,17 @@ import (
|
|||
|
||||
"github.com/autobrr/autobrr/internal/domain"
|
||||
"github.com/autobrr/autobrr/pkg/lidarr"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
func (s *service) lidarr(release domain.Release, action domain.Action) ([]string, error) {
|
||||
log.Trace().Msg("action LIDARR")
|
||||
s.log.Trace().Msg("action LIDARR")
|
||||
|
||||
// TODO validate data
|
||||
|
||||
// get client for action
|
||||
client, err := s.clientSvc.FindByID(context.TODO(), action.ClientID)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msgf("lidarr: error finding client: %v", action.ClientID)
|
||||
s.log.Error().Err(err).Msgf("lidarr: error finding client: %v", action.ClientID)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
@ -61,17 +59,17 @@ func (s *service) lidarr(release domain.Release, action domain.Action) ([]string
|
|||
|
||||
rejections, err := arr.Push(r)
|
||||
if err != nil {
|
||||
log.Error().Stack().Err(err).Msgf("lidarr: failed to push release: %v", r)
|
||||
s.log.Error().Stack().Err(err).Msgf("lidarr: failed to push release: %v", r)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if rejections != nil {
|
||||
log.Debug().Msgf("lidarr: release push rejected: %v, indexer %v to %v reasons: '%v'", r.Title, r.Indexer, client.Host, rejections)
|
||||
s.log.Debug().Msgf("lidarr: release push rejected: %v, indexer %v to %v reasons: '%v'", r.Title, r.Indexer, client.Host, rejections)
|
||||
|
||||
return rejections, nil
|
||||
}
|
||||
|
||||
log.Debug().Msgf("lidarr: successfully pushed release: %v, indexer %v to %v", r.Title, r.Indexer, client.Host)
|
||||
s.log.Debug().Msgf("lidarr: successfully pushed release: %v, indexer %v to %v", r.Title, r.Indexer, client.Host)
|
||||
|
||||
return nil, nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue