Skip to content

LLDB-DAP extension should provide better logging to diagnose issues #146880

@award999

Description

@award999

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:

  1. Have an LLDB-DAP OutputChannel where users can view some messaging provided by the extension to possibly diagnose their own problems.
  2. 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.
  3. 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.
  4. Add a transport the writes to the OutputChannel. By default the OutputChannel transport will have log level info
  5. A log file transport will be added to write a log file under the logUri folder, and this log will be at the debug log level. So the log file captures everything to help with diagnosing issues, but the OutputChannel is less verbose, providing the user with info that may help them self-diagnose setup problems.
  6. Add a new lldb-dap.verboseLogging boolean settings, that will (1) change the OutputChannel log level from info to debug, and (2) make sure the LLDBDAP_LOG environment variable is set. If the lldb-dap.log-path setting is set by the user then will use this path, otherwise write the session log to logUri/lldb-dap-session-YYYYMMDDHHMMSS.log

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementImproving things as opposed to bug fixing, e.g. new or missing featurelldb-dap

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions