mirror of
https://github.com/golang/go
synced 2024-11-18 18:24:48 -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:
parent
ec2e11d257
commit
716555639d
6
internal/lsp/cache/view.go
vendored
6
internal/lsp/cache/view.go
vendored
@ -13,7 +13,6 @@ import (
|
|||||||
"go/token"
|
"go/token"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
stdlog "log"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"reflect"
|
"reflect"
|
||||||
@ -30,6 +29,7 @@ import (
|
|||||||
"golang.org/x/tools/internal/memoize"
|
"golang.org/x/tools/internal/memoize"
|
||||||
"golang.org/x/tools/internal/span"
|
"golang.org/x/tools/internal/span"
|
||||||
"golang.org/x/tools/internal/telemetry/log"
|
"golang.org/x/tools/internal/telemetry/log"
|
||||||
|
"golang.org/x/tools/internal/telemetry/tag"
|
||||||
"golang.org/x/tools/internal/xcontext"
|
"golang.org/x/tools/internal/xcontext"
|
||||||
errors "golang.org/x/xerrors"
|
errors "golang.org/x/xerrors"
|
||||||
)
|
)
|
||||||
@ -355,9 +355,9 @@ func (v *view) refreshProcessEnv() {
|
|||||||
v.importsMu.Unlock()
|
v.importsMu.Unlock()
|
||||||
|
|
||||||
// We don't have a context handy to use for logging, so use the stdlib for now.
|
// 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)
|
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.importsMu.Lock()
|
||||||
v.cacheRefreshDuration = time.Since(start)
|
v.cacheRefreshDuration = time.Since(start)
|
||||||
|
Loading…
Reference in New Issue
Block a user