Add more info in search log message

This commit is contained in:
Deluan 2022-07-27 14:59:01 -04:00 committed by Joe Stump
parent dac39d1d4f
commit e0ac640d4e
No known key found for this signature in database
GPG Key ID: 29151C3EC48A0EB9

View File

@ -60,14 +60,14 @@ func doSearch[T any](ctx context.Context, wg *sync.WaitGroup, s searchFunc[T], q
}
done := make(chan struct{})
go func() {
typ := reflect.TypeOf(res).String()
typ := strings.TrimPrefix(reflect.TypeOf(res).String(), "model.")
var err error
start := time.Now()
res, err = s(q, offset, size)
if err != nil {
log.Error(ctx, "Error searching "+typ, err)
log.Error(ctx, "Error searching "+typ, "query", q, err)
} else {
log.Trace(ctx, "Search for "+typ+" completed", "elapsedTime", time.Since(start))
log.Trace(ctx, "Search for "+typ+" completed", "query", q, "elapsedTime", time.Since(start))
}
done <- struct{}{}
}()