add logging

This commit is contained in:
filifa 2024-07-11 19:42:59 -05:00
parent bd1a1128d8
commit d96c3f5d84
1 changed files with 5 additions and 0 deletions

View File

@ -3,6 +3,7 @@ package statsapi
import ( import (
"encoding/json" "encoding/json"
"errors" "errors"
"log"
"strconv" "strconv"
"strings" "strings"
) )
@ -45,8 +46,10 @@ func patch(obj any, path string, value any) error {
if !found { if !found {
switch v := obj.(type) { switch v := obj.(type) {
case *FeedResponse: case *FeedResponse:
log.Println("Formerly %v", (*v)[first])
(*v)[first] = value (*v)[first] = value
case map[string]any: case map[string]any:
log.Println("Formerly %v", v[first])
v[first] = value v[first] = value
case []any: case []any:
idx, err := strconv.Atoi(first) idx, err := strconv.Atoi(first)
@ -97,7 +100,9 @@ func patch(obj any, path string, value any) error {
} }
func (f *FeedResponse) Patch(instr *instruction) { func (f *FeedResponse) Patch(instr *instruction) {
log.Println("updating %v to %v", instr.Path, instr.Value)
err := patch(f, instr.Path, instr.Value) err := patch(f, instr.Path, instr.Value)
if err != nil { if err != nil {
log.Println(err)
} }
} }