chore: remove debug logging from animeschedule integration
This commit is contained in:
@@ -5,7 +5,6 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"mal/internal/observability"
|
|
||||||
"mal/pkg/net/limits"
|
"mal/pkg/net/limits"
|
||||||
"mal/pkg/net/useragent"
|
"mal/pkg/net/useragent"
|
||||||
"net/http"
|
"net/http"
|
||||||
@@ -64,7 +63,6 @@ func scheduleLocation() *time.Location {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func FetchWeek(ctx context.Context, httpClient *http.Client, year int, week int) (WeekSchedule, error) {
|
func FetchWeek(ctx context.Context, httpClient *http.Client, year int, week int) (WeekSchedule, error) {
|
||||||
debugScrape := os.Getenv("ANIMESCHEDULE_DEBUG_SCRAPE") == "1"
|
|
||||||
apiToken := strings.TrimSpace(os.Getenv("ANIMESCHEDULE_API_TOKEN"))
|
apiToken := strings.TrimSpace(os.Getenv("ANIMESCHEDULE_API_TOKEN"))
|
||||||
|
|
||||||
if apiToken != "" {
|
if apiToken != "" {
|
||||||
@@ -148,31 +146,11 @@ func FetchWeek(ctx context.Context, httpClient *http.Client, year int, week int)
|
|||||||
metaText := strings.Join(strings.Fields(strings.TrimSpace(meta.Text())), " ")
|
metaText := strings.Join(strings.Fields(strings.TrimSpace(meta.Text())), " ")
|
||||||
|
|
||||||
epText, _, airType := parseMeta(metaText)
|
epText, _, airType := parseMeta(metaText)
|
||||||
localTime, rawDatetime, rawRenderedTime := parseLocalTime(meta)
|
localTime, _, _ := parseLocalTime(meta)
|
||||||
if title == "" || animeURL == "" || localTime == "" || airType == "" {
|
if title == "" || animeURL == "" || localTime == "" || airType == "" {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if debugScrape {
|
|
||||||
observability.LogJSON(
|
|
||||||
observability.LogLevelInfo,
|
|
||||||
"animeschedule_scrape_time",
|
|
||||||
"integrations/animeschedule",
|
|
||||||
"scraped time info for entry",
|
|
||||||
map[string]any{
|
|
||||||
"title": title,
|
|
||||||
"anime_url": animeURL,
|
|
||||||
"meta_text": metaText,
|
|
||||||
"raw_datetime": rawDatetime,
|
|
||||||
"raw_renderedTime": rawRenderedTime,
|
|
||||||
"local_time": localTime,
|
|
||||||
"week": resolvedWeek,
|
|
||||||
"year": resolvedYear,
|
|
||||||
},
|
|
||||||
nil,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
dayEntries = append(dayEntries, Entry{
|
dayEntries = append(dayEntries, Entry{
|
||||||
Title: title,
|
Title: title,
|
||||||
AnimeURL: animeURL,
|
AnimeURL: animeURL,
|
||||||
@@ -461,19 +439,5 @@ func fetchWeekAPI(ctx context.Context, httpClient *http.Client, token string, ye
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
observability.LogJSON(
|
|
||||||
observability.LogLevelInfo,
|
|
||||||
"animeschedule_api_timetables_loaded",
|
|
||||||
"integrations/animeschedule",
|
|
||||||
"loaded timetable entries via api",
|
|
||||||
map[string]any{
|
|
||||||
"count": len(payload),
|
|
||||||
"year": out.Year,
|
|
||||||
"week": out.Week,
|
|
||||||
"tz": tz,
|
|
||||||
},
|
|
||||||
nil,
|
|
||||||
)
|
|
||||||
|
|
||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user