swyddfa / esbonio

A language server for working with Sphinx projects.
https://docs.esbon.io/
121 stars 21 forks source link

Overhaul logging configuration #748

Closed alcarney closed 4 months ago

alcarney commented 4 months ago

With the logging level set to debug, the server produces a lot of output!

The logged information is also useful in a variety of scenarios so it doesn't make sense to remove the messages entirely. Instead, this PR overhauls the server's logging configuration options, giving the user finer-grained control over the output.

The server will now also write log messages to stderr by default, which is hopefully compatible with a wider range of clients out of the box.

Examples

The following is equivalent to the server's default logging configuration

   {
     "esbonio": {
       "logging": {
         "level": "error",
         "format": "[%(name)s]: %(message)s",
         "stderr": true,
         "config": {
           "sphinx": {
             "level": "info",
             "format": "%(message)s"
           }
         }
       }
     }
   }

This sets the default log level to debug and dials back or redirects the output from some of the noisier loggers

   {
     "esbonio": {
       "logging": {
         "level": "debug",
         "config": {
           "esbonio.Configuration": {
             "level": "info"
           },
           "esbonio.PreviewServer": {
             "filename": "http.log",
             "stderr": false
           },
           "esbonio.WebviewServer": {
             "level": "error"
           }
         }
       }
     }
   }

Once this is merged the docs will include details on the new config options.