<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/146880>146880</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            LLDB-DAP extension should provide better logging to diagnose issues
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          award999
      </td>
    </tr>
</table>

<pre>
    While trying to diagnose debugging issues experienced by users of the [vscode-swift](https://github.com/swiftlang/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](https://code.visualstudio.com/api/references/vscode-api#OutputChannel) where users can view some messaging provided by the extension to possibly diagnose their own problems.
2. On activate the provided [ExtensionContext](https://code.visualstudio.com/api/references/vscode-api#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](https://github.com/winstonjs/winston) is a popular MIT module for handling logging. The great thing about winston is you can [add multiple transports](https://github.com/winstonjs/winston?tab=readme-ov-file#adding-custom-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`
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJycVt1u2zgTfRr6ZmBBpmLHvvCFE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