mirror of
https://github.com/golang/go
synced 2024-11-18 16:54:43 -07:00
internal/lsp: suppress info and default logging unless a verbose flag is supplied
Change-Id: Ib4bf2a47cad4151b4b64d922855013b22b4fbb15 Reviewed-on: https://go-review.googlesource.com/c/tools/+/176641 Reviewed-by: Rebecca Stambler <rstambler@golang.org>
This commit is contained in:
parent
80b1e8742c
commit
90441677ad
@ -47,6 +47,9 @@ type Application struct {
|
||||
|
||||
// Support for remote lsp server
|
||||
Remote string `flag:"remote" help:"*EXPERIMENTAL* - forward all commands to a remote lsp"`
|
||||
|
||||
// Enable verbose logging
|
||||
Verbose bool `flag:"v" help:"Verbose output"`
|
||||
}
|
||||
|
||||
// Name implements tool.Application returning the binary name.
|
||||
@ -225,11 +228,17 @@ func (c *cmdClient) LogMessage(ctx context.Context, p *protocol.LogMessageParams
|
||||
case protocol.Warning:
|
||||
log.Print("Warning:", p.Message)
|
||||
case protocol.Info:
|
||||
log.Print("Info:", p.Message)
|
||||
if c.app.Verbose {
|
||||
log.Print("Info:", p.Message)
|
||||
}
|
||||
case protocol.Log:
|
||||
log.Print("Log:", p.Message)
|
||||
if c.app.Verbose {
|
||||
log.Print("Log:", p.Message)
|
||||
}
|
||||
default:
|
||||
log.Print(p.Message)
|
||||
if c.app.Verbose {
|
||||
log.Print(p.Message)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user