add logging
This commit is contained in:
parent
bd1a1128d8
commit
d96c3f5d84
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue