internal/lsp: purge the remains of the xlog system now it is not used

Change-Id: Iad8f037de88c2657734b8a1b5c73fc708d3b5924
Reviewed-on: https://go-review.googlesource.com/c/tools/+/186198
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
diff --git a/internal/lsp/lsp_test.go b/internal/lsp/lsp_test.go
index f8a818c..5b563cd 100644
--- a/internal/lsp/lsp_test.go
+++ b/internal/lsp/lsp_test.go
@@ -21,7 +21,6 @@
 	"golang.org/x/tools/internal/lsp/protocol"
 	"golang.org/x/tools/internal/lsp/source"
 	"golang.org/x/tools/internal/lsp/tests"
-	"golang.org/x/tools/internal/lsp/xlog"
 	"golang.org/x/tools/internal/span"
 )
 
@@ -42,7 +41,6 @@
 	data := tests.Load(t, exporter, "testdata")
 	defer data.Exported.Cleanup()
 
-	ctx = xlog.With(ctx, xlog.StdSink{})
 	cache := cache.New()
 	session := cache.NewSession(ctx)
 	view := session.NewView(ctx, viewName, span.FileURI(data.Config.Dir))
diff --git a/internal/lsp/protocol/context.go b/internal/lsp/protocol/context.go
index 6112ca6..7a30c1d 100644
--- a/internal/lsp/protocol/context.go
+++ b/internal/lsp/protocol/context.go
@@ -7,7 +7,6 @@
 
 	"golang.org/x/tools/internal/lsp/telemetry/log"
 	"golang.org/x/tools/internal/lsp/telemetry/tag"
-	"golang.org/x/tools/internal/lsp/xlog"
 	"golang.org/x/tools/internal/xcontext"
 )
 
@@ -22,7 +21,6 @@
 )
 
 func WithClient(ctx context.Context, client Client) context.Context {
-	ctx = xlog.With(ctx, logSink{client: client})
 	return context.WithValue(ctx, clientKey, client)
 }
 
diff --git a/internal/lsp/protocol/log.go b/internal/lsp/protocol/log.go
deleted file mode 100644
index dfd80d0..0000000
--- a/internal/lsp/protocol/log.go
+++ /dev/null
@@ -1,25 +0,0 @@
-package protocol
-
-import (
-	"context"
-
-	"golang.org/x/tools/internal/lsp/xlog"
-)
-
-// logSink implements xlog.Sink in terms of the LogMessage call to a client.
-type logSink struct {
-	client Client
-}
-
-func (s logSink) Log(ctx context.Context, level xlog.Level, message string) {
-	typ := Log
-	switch level {
-	case xlog.ErrorLevel:
-		typ = Error
-	case xlog.InfoLevel:
-		typ = Info
-	case xlog.DebugLevel:
-		typ = Log
-	}
-	s.client.LogMessage(ctx, &LogMessageParams{Type: typ, Message: message})
-}
diff --git a/internal/lsp/source/source_test.go b/internal/lsp/source/source_test.go
index 081009c..b74ec42 100644
--- a/internal/lsp/source/source_test.go
+++ b/internal/lsp/source/source_test.go
@@ -19,7 +19,6 @@
 	"golang.org/x/tools/internal/lsp/diff"
 	"golang.org/x/tools/internal/lsp/source"
 	"golang.org/x/tools/internal/lsp/tests"
-	"golang.org/x/tools/internal/lsp/xlog"
 	"golang.org/x/tools/internal/span"
 )
 
@@ -38,7 +37,6 @@
 	data := tests.Load(t, exporter, "../testdata")
 	defer data.Exported.Cleanup()
 
-	ctx = xlog.With(ctx, xlog.StdSink{})
 	cache := cache.New()
 	session := cache.NewSession(ctx)
 	r := &runner{
diff --git a/internal/lsp/xlog/xlog.go b/internal/lsp/xlog/xlog.go
deleted file mode 100644
index 9a6c753..0000000
--- a/internal/lsp/xlog/xlog.go
+++ /dev/null
@@ -1,90 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package xlog
-
-import (
-	"context"
-	"fmt"
-	"log"
-)
-
-// logger is a wrapper over a sink to provide a clean API over the core log
-// function.
-type logger struct {
-	sink Sink
-}
-
-// Level indicates the severity of the logging message.
-type Level int
-
-const (
-	ErrorLevel = Level(iota)
-	InfoLevel
-	DebugLevel
-)
-
-// Sink is the interface to something that consumes logging messages.
-// This can be implemented and then registered with a context to control the
-// destination or formatting of logging.
-type Sink interface {
-	Log(ctx context.Context, level Level, message string)
-}
-
-// StdSink is a Sink that writes to the standard log package.
-type StdSink struct{}
-
-// Errorf is intended for the logging of errors that we could not easily return
-// to the client but that caused problems internally.
-func (l logger) Errorf(ctx context.Context, format string, args ...interface{}) {
-	l.sink.Log(ctx, ErrorLevel, fmt.Sprintf(format, args...))
-}
-
-// Infof is intended for logging of messages that may help the user understand
-// the behavior or be useful in a bug report.
-func (l logger) Infof(ctx context.Context, format string, args ...interface{}) {
-	l.sink.Log(ctx, InfoLevel, fmt.Sprintf(format, args...))
-}
-
-// Debugf is intended to be used only while debugging.
-func (l logger) Debugf(ctx context.Context, format string, args ...interface{}) {
-	l.sink.Log(ctx, DebugLevel, fmt.Sprintf(format, args...))
-}
-
-// Log implements Sink for the StdSink.
-// It writes the message using log.Print with a level based prefix.
-func (StdSink) Log(ctx context.Context, level Level, message string) {
-	switch level {
-	case ErrorLevel:
-		log.Print("Error: ", message)
-	case InfoLevel:
-		log.Print("Info: ", message)
-	case DebugLevel:
-		log.Print("Debug: ", message)
-	}
-}
-
-type contextKeyType int
-
-const contextKey = contextKeyType(0)
-
-func With(ctx context.Context, sink Sink) context.Context {
-	return context.WithValue(ctx, contextKey, sink)
-}
-
-func From(ctx context.Context) logger {
-	return logger{sink: ctx.Value(contextKey).(Sink)}
-}
-
-func Errorf(ctx context.Context, format string, args ...interface{}) {
-	From(ctx).Errorf(ctx, format, args...)
-}
-
-func Infof(ctx context.Context, format string, args ...interface{}) {
-	From(ctx).Infof(ctx, format, args...)
-}
-
-func Debugf(ctx context.Context, format string, args ...interface{}) {
-	From(ctx).Debugf(ctx, format, args...)
-}