ilya-biryukov added a comment.

In https://reviews.llvm.org/D44226#1030639, @simark wrote:

> In https://reviews.llvm.org/D44226#1030625, @ilya-biryukov wrote:
>
> > I would vouch for adding a log level instead. It's a very well understood 
> > concept that certainly covers this use-case and can be useful in other 
> > places.
> >  WDYT?
>
>
> I agree.  How would you prefer the flags to look like?
>
> - Use -v multiple times to be more verbose: "-v" to show info, "-v -v" to 
> show debug.  Without -v, we show warnings and errors.


Let's go with two levels (info and verbose) and a single `-v ` flag to enable 
the verbose level.
Keeping consistent the way people use many logging levels across the whole 
project is hard (i.e. different people might have different ideas about to 
distinguishing `warning` from `info`). A distinction between verbose and 
non-verbose messages should be easier to agree on.

As for the changes in the code, let's make the current `log` function emit info 
messages and add a `vlog` function that emits "verbose" messages. Verbose 
message are only output when `-v` is passed.



================
Comment at: clangd/JSONRPCDispatcher.cpp:312
+          // Log the formatted message.
+          log(llvm::formatv(Out.Pretty ? "<-- {0:2}\n" : "<-- {0}\n", *Doc));
+        }
----------------
Since we're replacing `log` with `vlog` here, could we add a normal info `log` 
that captures the name of the LSP method?  
And `log` with LSP method name should probably go before `vlog` with message 
contents, that's easy to achieve by moving the logging code into the body of 
`Dispatcher.call`


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D44226



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to