scalameta / metals

Scala language server with rich IDE features 🚀
https://scalameta.org/metals/
Apache License 2.0
2.08k stars 326 forks source link

Remove noise from logs #227

Closed olafurpg closed 5 years ago

olafurpg commented 6 years ago

.metals/metals.log emits a lot of noisy logs

18:41:24.968 INFO  s.m.m.s.InMemorySymbolIndex - resolveName at Uri(file:///Users/ollie/dev/metals/test-workspace/src/main/scala/example/User.scala):9:16
18:41:24.968 INFO  s.m.m.s.InMemorySymbolIndex - Found document for Uri(file:///Users/ollie/dev/metals/test-workspace/src/main/scala/example/User.scala)
18:41:24.969 INFO  s.m.m.s.InMemorySymbolIndex - Matching symbol _root_.java.lang.String#length()I.
18:41:25.218 INFO  s.m.m.s.InMemorySymbolIndex - resolveName at Uri(file:///Users/ollie/dev/metals/test-workspace/src/main/scala/example/User.scala):9:18
18:41:25.219 INFO  s.m.m.s.InMemorySymbolIndex - Found document for Uri(file:///Users/ollie/dev/metals/test-workspace/src/main/scala/example/User.scala)
18:41:25.220 INFO  s.m.m.s.InMemorySymbolIndex - Matching symbol _root_.java.lang.String#length()I.
18:41:25.794 INFO  s.m.m.s.InMemorySymbolIndex - resolveName at Uri(file:///Users/ollie/dev/metals/test-workspace/src/main/scala/example/User.scala):9:18
18:41:25.794 INFO  s.m.m.s.InMemorySymbolIndex - Found document for Uri(file:///Users/ollie/dev/metals/test-workspace/src/main/scala/example/User.scala)
18:41:25.795 INFO  s.m.m.s.InMemorySymbolIndex - Matching symbol _root_.java.lang.String#length()I.

We should clean up the logs so that they are easier to read. I'm wondering if we can figure out a way to override the default log level so that we can get extra verbose output when debugging. Any ideas?

gabro commented 6 years ago

I think that's doable by passing a loglevel as an option to the server and configuring the vscode launcher to pass the option when launched in debug mode.

laughedelic commented 6 years ago

By the way, from the LSP point of view all messages are logged with the "debug" level:

https://github.com/laughedelic/metals/blob/6f55b052ee51624fcc18e495db5de31d6de6d214/lsp4s/src/main/scala/org/langmeta/lsp/Endpoints.scala#L79-L81

I think they should use info/warn/error/log levels. In Atom they currently all look the same:

screen shot 2018-03-16 at 04 31 44

But sbt messages look different, because they set this level properly (except for those "Done"/"Processing", which are a whole different story):

screen shot 2018-03-26 at 23 48 51
olafurpg commented 5 years ago

328 takes steps towards at least improving the formatting of log messages

screen shot 2018-09-27 at 18 11 44

gabro commented 5 years ago

wdyt about configuring the minimum debug level according to a configuration option?

big +1 on this, it would also be useful for the vscode client, which has different run configurations (debug/"prod") already.

olafurpg commented 5 years ago

All log entries have been removed in #292, we can restart this discussion in case the new implementation emits noisy logs. I will do my best to keep the noise down