mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 00:39:13 +00:00
feat(actions): improve errors and logs (#340)
This commit is contained in:
parent
31fbe013ff
commit
402596523d
15 changed files with 315 additions and 418 deletions
|
@ -7,6 +7,7 @@ import (
|
|||
"github.com/autobrr/autobrr/internal/domain"
|
||||
"github.com/autobrr/autobrr/internal/download_client"
|
||||
"github.com/autobrr/autobrr/internal/logger"
|
||||
"github.com/autobrr/autobrr/pkg/qbittorrent"
|
||||
|
||||
"github.com/asaskevich/EventBus"
|
||||
"github.com/dcarbone/zadapters/zstdlog"
|
||||
|
@ -21,7 +22,11 @@ type Service interface {
|
|||
ToggleEnabled(actionID int) error
|
||||
|
||||
RunAction(action *domain.Action, release domain.Release) ([]string, error)
|
||||
CheckCanDownload(actions []domain.Action) bool
|
||||
}
|
||||
|
||||
type qbitKey struct {
|
||||
I int // type
|
||||
N string // name
|
||||
}
|
||||
|
||||
type service struct {
|
||||
|
@ -30,14 +35,17 @@ type service struct {
|
|||
repo domain.ActionRepo
|
||||
clientSvc download_client.Service
|
||||
bus EventBus.Bus
|
||||
|
||||
qbitClients map[qbitKey]*qbittorrent.Client
|
||||
}
|
||||
|
||||
func NewService(log logger.Logger, repo domain.ActionRepo, clientSvc download_client.Service, bus EventBus.Bus) Service {
|
||||
s := &service{
|
||||
log: log.With().Str("module", "action").Logger(),
|
||||
repo: repo,
|
||||
clientSvc: clientSvc,
|
||||
bus: bus,
|
||||
log: log.With().Str("module", "action").Logger(),
|
||||
repo: repo,
|
||||
clientSvc: clientSvc,
|
||||
bus: bus,
|
||||
qbitClients: map[qbitKey]*qbittorrent.Client{},
|
||||
}
|
||||
|
||||
s.subLogger = zstdlog.NewStdLoggerWithLevel(s.log.With().Logger(), zerolog.TraceLevel)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue