swiftlang / sourcekit-lsp

Language Server Protocol implementation for Swift and C-based languages
Apache License 2.0
3.3k stars 273 forks source link

Write log messages to files on non-Darwin platforms #1411

Closed ahoppen closed 4 months ago

ahoppen commented 4 months ago

Instead of logging to stderr, write log messages to files in /var/log/sourcekit-lsp/sourcekit-lsp-<pid>.log.

This allows us to retrieve the log messages from sourcekit-lsp diagnose.

Fixes #1286 rdar://127138318

ahoppen commented 4 months ago

@swift-ci Please test

ahoppen commented 4 months ago

I re-wrote the implementation quite a bit based on feedback from @bnbarham to roll through 10 log files of 5MB each instead of truncating one log file in place since it reduces the number of bytes that need to be written (in the old implementation we needed to write 4MB every time we trimmed the start of the log).

ahoppen commented 4 months ago

@swift-ci Please test

ahoppen commented 4 months ago

@swift-ci Please test Windows

ahoppen commented 4 months ago

@swift-ci Please test

ahoppen commented 4 months ago

@swift-ci Please test Windows