Логирование: ревью всего кода и рефакторинг в соответствии с конвенциями
This commit is contained in:
@@ -9,6 +9,8 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"git.vakhrushev.me/av/jellybit/internal/logging"
|
||||
)
|
||||
|
||||
const tvmazeDefaultBaseURL = "https://api.tvmaze.com"
|
||||
@@ -68,11 +70,9 @@ func (t *TVMaze) Search(ctx context.Context, q Query) ([]Candidate, error) {
|
||||
Show tvmazeShow `json:"show"`
|
||||
}
|
||||
rawURL := t.baseURL + "/search/shows?q=" + url.QueryEscape(q.Title)
|
||||
t.log.Debug("tvmaze: search", "title", q.Title)
|
||||
if err := getJSON(ctx, t.hc, t.log, rawURL, nil, &resp); err != nil {
|
||||
if err := getJSON(ctx, t.hc, t.log, logging.ServiceTVMaze, "search/shows", rawURL, nil, &resp); err != nil {
|
||||
return nil, fmt.Errorf("tvmaze search: %w", err)
|
||||
}
|
||||
t.log.Debug("tvmaze: search done", "title", q.Title, "results", len(resp))
|
||||
|
||||
out := make([]Candidate, 0, len(resp))
|
||||
for _, r := range resp {
|
||||
@@ -104,7 +104,7 @@ type tvmazeEpisode struct {
|
||||
func (t *TVMaze) SeasonEpisodeCounts(ctx context.Context, id string) (map[int]int, error) {
|
||||
var eps []tvmazeEpisode
|
||||
rawURL := t.baseURL + "/shows/" + url.PathEscape(id) + "/episodes"
|
||||
if err := getJSON(ctx, t.hc, t.log, rawURL, nil, &eps); err != nil {
|
||||
if err := getJSON(ctx, t.hc, t.log, logging.ServiceTVMaze, "shows/episodes", rawURL, nil, &eps); err != nil {
|
||||
return nil, fmt.Errorf("tvmaze episodes %s: %w", id, err)
|
||||
}
|
||||
out := map[int]int{}
|
||||
|
||||
Reference in New Issue
Block a user