logutil: add Trace and TraceContext helpers (#12110)

This commit is contained in:
Michael Yang
2025-09-02 13:09:12 -07:00
committed by GitHub
parent 8149a3c86e
commit fb92b61754
7 changed files with 22 additions and 18 deletions

View File

@@ -1,12 +1,10 @@
package model
import (
"context"
"errors"
"fmt"
_ "image/jpeg"
_ "image/png"
"log/slog"
"os"
"reflect"
"strconv"
@@ -198,7 +196,7 @@ func populateFields(base Base, v reflect.Value, tags ...Tag) reflect.Value {
names := fn(tagsCopy)
for _, name := range names {
if tensor := base.Backend().Get(strings.Join(name, ".")); tensor != nil {
slog.Log(context.TODO(), logutil.LevelTrace, "found tensor", "", tensor)
logutil.Trace("found tensor", "", tensor)
vv.Set(reflect.ValueOf(tensor))
break
}