Skip to content

Commit 3b87dc6

Browse files
committed
Log to stderr as well as the log file, on non-Darwin platforms
This is consistent with other LSP servers, and makes debugging sourcekit-lsp easier.
1 parent 8a908f2 commit 3b87dc6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Sources/SKLogging/SetGlobalLogFileHandler.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@ private func logToFile(message: String, logDirectory: URL, logFileMaxBytes: Int,
116116
private func setUpGlobalLogFileHandlerImpl(logFileDirectory: URL, logFileMaxBytes: Int, logRotateCount: Int) {
117117
logHandler = { @LogHandlerActor message in
118118
do {
119+
// In addition to writing to the log file, also log to stderr, so LSP output is visible in the editor
120+
// (e.g. VS Code's Output panel).
121+
fputs(message + "\n", stderr)
122+
119123
try logToFile(
120124
message: message,
121125
logDirectory: logFileDirectory,

0 commit comments

Comments
 (0)