Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overhaul logging configuration #748

Merged
merged 8 commits into from
Mar 4, 2024
Merged

Conversation

alcarney
Copy link
Member

@alcarney alcarney commented Mar 3, 2024

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.

It's not currently used and can be brought back as a filter if required
The server's logging configuration has been overhauled to be much more
flexible. The server now has a default configuration that it follows,
but it is now possible for the user to provide overrides for specific
loggers giving them fine grained control over the output.

All logging options have been moved into the `esbonio.logging.*`
configuration namespace.

The server now defaults to printing log messages to stderr, which
should better aligned to the majority of language clients by default
This has always been there thanks to VSCode's language client, this
commit finally exposes the option in the settings UI/completion
suggestions
This allows them to be "replayed" once the user's logging
configuration is known
@alcarney alcarney merged commit 031b2d4 into swyddfa:develop Mar 4, 2024
13 of 14 checks passed
@alcarney alcarney deleted the logging-config branch March 4, 2024 23:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant