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