-
Notifications
You must be signed in to change notification settings - Fork 304
Log to stderr as well as the log file, on non-Darwin platforms #2155
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do log to stderr
until we set up the global log file handlers using setUpGlobalLogFileHandler
. We should also log to stderr from there. With the current implementation, we would log every message twice if setting up the global log file handlers failed (once from the log handler and then once again from your fputs
call).
Gotcha, presumably something like this is better? |
@swift-ci please test |
This is consistent with other LSP servers, and makes debugging sourcekit-lsp easier.
@swift-ci please test |
I'm not sure this is actually possible with our current implementation. All the calls are direct to OSLog and That also makes me wonder if we want this in general, since it means we have very different output to LSP clients between the platforms. EDIT: Ah, it seems like various editors also treat stderr output as actual errors (eg. neovim logs stderr output with the format "[ERROR][timestamp] ..."). So it may indeed be best to avoid doing this generally. I've opened #2161 which seems like a better direction to go here. |
This is consistent with other LSP servers, and makes debugging sourcekit-lsp easier.
This was initially discussed in #2116. Let me know if you think we should log to stderr on macOS too.