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
|
// Support for remote lsp server
|
||||||
Remote string `flag:"remote" help:"*EXPERIMENTAL* - forward all commands to a remote lsp"`
|
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.
|
// Name implements tool.Application returning the binary name.
|
||||||
|
@ -225,12 +228,18 @@ func (c *cmdClient) LogMessage(ctx context.Context, p *protocol.LogMessageParams
|
||||||
case protocol.Warning:
|
case protocol.Warning:
|
||||||
log.Print("Warning:", p.Message)
|
log.Print("Warning:", p.Message)
|
||||||
case protocol.Info:
|
case protocol.Info:
|
||||||
|
if c.app.Verbose {
|
||||||
log.Print("Info:", p.Message)
|
log.Print("Info:", p.Message)
|
||||||
|
}
|
||||||
case protocol.Log:
|
case protocol.Log:
|
||||||
|
if c.app.Verbose {
|
||||||
log.Print("Log:", p.Message)
|
log.Print("Log:", p.Message)
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
|
if c.app.Verbose {
|
||||||
log.Print(p.Message)
|
log.Print(p.Message)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue