add logging
This commit is contained in:
@@ -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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user