Open
Description
While trying to diagnose debugging issues experienced by users of the vscode-swift extension, I have been finding it hard to get sufficient information and logging to diagnose issues with the LLDB-DAP extension. I would like to propose the following setup which I have found worked well in other extensions I've worked on:
- Have an
LLDB-DAP
OutputChannel where users can view some messaging provided by the extension to possibly diagnose their own problems. - On activate the provided ExtensionContext has a
logUri
property where VSCode wants the extension to write log files. There is a timestamped folder so you can find logs for older sessions. - winston is a popular MIT module for handling logging. The great thing about winston is you can add multiple transports. So you have one common logging interface but winston handles the writing to the multiple data sinks.
- Add a transport the writes to the
OutputChannel
. By default theOutputChannel
transport will have log levelinfo
- A log file transport will be added to write a log file under the
logUri
folder, and this log will be at thedebug
log level. So the log file captures everything to help with diagnosing issues, but theOutputChannel
is less verbose, providing the user with info that may help them self-diagnose setup problems. - Add a new
lldb-dap.verboseLogging
boolean settings, that will (1) change theOutputChannel
log level frominfo
todebug
, and (2) make sure theLLDBDAP_LOG
environment variable is set. If thelldb-dap.log-path
setting is set by the user then will use this path, otherwise write the session log tologUri/lldb-dap-session-YYYYMMDDHHMMSS.log