diff options
| author | Peter Stone <thepeterstone@gmail.com> | 2026-01-22 15:54:25 -1000 |
|---|---|---|
| committer | Peter Stone <thepeterstone@gmail.com> | 2026-01-22 15:54:25 -1000 |
| commit | c9c17431cdddb64a8d44f77c43281a29270f81c2 (patch) | |
| tree | c355984fb732b01e84b42f18750879d7ffdaf0d2 /internal | |
| parent | 7c1e88ef3cea6b2f08bc6e63031ad4de041e8bf3 (diff) | |
Add debug logging for Trello card fetching
Log API responses and errors to diagnose empty boards issue.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/api/trello.go | 11 | ||||
| -rw-r--r-- | internal/handlers/handlers.go | 10 |
2 files changed, 19 insertions, 2 deletions
diff --git a/internal/api/trello.go b/internal/api/trello.go index 037c881..665bce0 100644 --- a/internal/api/trello.go +++ b/internal/api/trello.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" "io" + "log" "net/http" "net/url" "sort" @@ -136,6 +137,8 @@ func (c *TrelloClient) GetCards(ctx context.Context, boardID string) ([]models.C return nil, fmt.Errorf("failed to decode response: %w", err) } + log.Printf("Trello GetCards: board %s returned %d cards from API", boardID, len(apiCards)) + // Fetch lists to get list names lists, err := c.getLists(ctx, boardID) listMap := make(map[string]string) @@ -238,7 +241,9 @@ func (c *TrelloClient) GetBoardsWithCards(ctx context.Context) ([]models.Board, // Fetch cards cards, err := c.GetCards(ctx, boards[i].ID) - if err == nil { + if err != nil { + log.Printf("Error fetching cards for board %s (%s): %v", boards[i].Name, boards[i].ID, err) + } else { // Set BoardName for each card for j := range cards { cards[j].BoardName = boards[i].Name @@ -249,7 +254,9 @@ func (c *TrelloClient) GetBoardsWithCards(ctx context.Context) ([]models.Board, // Fetch lists lists, err := c.getLists(ctx, boards[i].ID) - if err == nil { + if err != nil { + log.Printf("Error fetching lists for board %s: %v", boards[i].Name, err) + } else { boards[i].Lists = lists } }(i) diff --git a/internal/handlers/handlers.go b/internal/handlers/handlers.go index 1cb978d..84a00fd 100644 --- a/internal/handlers/handlers.go +++ b/internal/handlers/handlers.go @@ -523,6 +523,16 @@ func (h *Handler) fetchBoards(ctx context.Context, forceRefresh bool) ([]models. return nil, err } + // Debug: log what we got from API + totalCards := 0 + for _, b := range boards { + totalCards += len(b.Cards) + if len(b.Cards) > 0 { + log.Printf("Trello API: Board %q has %d cards", b.Name, len(b.Cards)) + } + } + log.Printf("Trello API: Fetched %d boards with %d total cards", len(boards), totalCards) + // Save to cache if err := h.store.SaveBoards(boards); err != nil { log.Printf("Failed to save boards to cache: %v", err) |
