1
0
mirror of https://github.com/golang/go synced 2024-11-18 16:14:46 -07:00

internal/lsp/cache: use telemetry logging for imports refresh

Any context that came in through the lsp protocol package will work, live or dead.

Change-Id: I7566ec07b09e1c8e54a5255ebda8553843cfe974
Reviewed-on: https://go-review.googlesource.com/c/tools/+/216846
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
This commit is contained in:
Heschi Kreinick 2020-01-29 16:35:56 -05:00
parent ec2e11d257
commit 716555639d

View File

@ -13,7 +13,6 @@ import (
"go/token"
"io"
"io/ioutil"
stdlog "log"
"os"
"path/filepath"
"reflect"
@ -30,6 +29,7 @@ import (
"golang.org/x/tools/internal/memoize"
"golang.org/x/tools/internal/span"
"golang.org/x/tools/internal/telemetry/log"
"golang.org/x/tools/internal/telemetry/tag"
"golang.org/x/tools/internal/xcontext"
errors "golang.org/x/xerrors"
)
@ -355,9 +355,9 @@ func (v *view) refreshProcessEnv() {
v.importsMu.Unlock()
// We don't have a context handy to use for logging, so use the stdlib for now.
stdlog.Printf("background imports cache refresh starting")
log.Print(v.baseCtx, "background imports cache refresh starting")
err := imports.PrimeCache(context.Background(), env)
stdlog.Printf("background refresh finished after %v with err: %v", time.Since(start), err)
log.Print(v.baseCtx, fmt.Sprintf("background refresh finished after %v", time.Since(start)), tag.Of("Error", err))
v.importsMu.Lock()
v.cacheRefreshDuration = time.Since(start)