You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add configuration options to adjust log level and log privacy level on non-Apple platforms
Also adjust the log privacy level on non-Apple platforms to `public` and don’t log potentially sensitive information by default.
rdar://132525691
Resolves#1591
SourceKit-LSP masks data that may contain private information such as source file names and contents by default. To enable logging of this information, run
To enable more verbose logging on non-macOS platforms, launch sourcekit-lsp with the `SOURCEKITLSP_LOG_LEVEL` environment variable set to `debug`.
108
-
101
+
SourceKit-LSP masks data that may contain private information such as source file names and contents by default. To enable logging of this information, follow the instructions in [Diagnose Bundle.md](Documentation/Diagnose%20Bundle.md).
Copy file name to clipboardExpand all lines: Documentation/Configuration File.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,6 +36,9 @@ The structure of the file is currently not guaranteed to be stable. Options may
36
36
-`indexPrefixMap: [string: string]`: Path remappings for remapping index data for local use.
37
37
-`maxCoresPercentageToUseForBackgroundIndexing: double`: A hint indicating how many cores background indexing should use at most (value between 0 and 1). Background indexing is not required to honor this setting
38
38
-`updateIndexStoreTimeout: int`: Number of seconds to wait for an update index store task to finish before killing it.
39
+
-`logging`: Dictionary with the following keys, changing SourceKit-LSP’s logging behavior on non-Apple platforms. On Apple platforms, logging is done through the [system log](Diagnose%20Bundle.md#Enable%20Extended%20Logging). These options can only be set globally and not per workspace.
40
+
-`logLevel: "debug"|"info"|"default"|"error"|"fault"`: The level from which one onwards log messages should be written.
41
+
-`privacyLevel: "public"|"private"|"sensitive"`: Whether potentially sensitive information should be redacted. Default is `public`, which redacts potentially sensitive information.
39
42
-`defaultWorkspaceType: "buildserver"|"compdb"|"swiftpm"`: Overrides workspace type selection logic.
40
43
-`generatedFilesPath: string`: Directory in which generated interfaces and macro expansions should be stored.
41
44
-`backgroundIndexing: bool`: Explicitly enable or disable background indexing.
Copy file name to clipboardExpand all lines: Documentation/Diagnose Bundle.md
+14Lines changed: 14 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,6 +20,20 @@ The diagnose bundle contains the following information:
20
20
21
21
Extended logging of SourceKit-LSP is not enabled by default because it contains information about your source code, directory structure and similar potentially sensitive information. Instead, the logging system redacts that information. If you are comfortable with sharing such information, you can enable extended SourceKit-LSP’s extended logging, which improves the ability of SourceKit-LSP developers to understand and fix issues.
22
22
23
+
### macOS
24
+
23
25
To enable extended logging on macOS, install the configuration profile from https://github.com/swiftlang/sourcekit-lsp/blob/main/Documentation/Enable%20Extended%20Logging.mobileconfig as described in https://support.apple.com/guide/mac-help/configuration-profiles-standardize-settings-mh35561/mac#mchlp41bd550. SourceKit-LSP will immediately stop redacting information and include them in the system log.
24
26
25
27
To disable extended logging again, remove the configuration profile as described in https://support.apple.com/guide/mac-help/configuration-profiles-standardize-settings-mh35561/mac#mchlpa04df41.
28
+
29
+
### Non-Apple platforms
30
+
31
+
Create a [configuration file](Configuration%20File.md) with the following contents at `~/.sourcekit-lsp/config.json` with the following contents:
Copy file name to clipboardExpand all lines: Documentation/Environment Variables.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,8 +10,8 @@ The following environment variables can be used to control some behavior in Sour
10
10
11
11
## Runtime
12
12
13
-
-`SOURCEKITLSP_LOG_LEVEL`: When using `NonDarwinLogger`, specify the level at which messages should be logged. Defaults to `default`. Use `debug` to increase to the highest log level.
14
-
-`SOURCEKITLSP_LOG_PRIVACY_LEVEL`: When using `NonDarwinLogger`, specifies whether information that might contain personal information (essentially source code) should be logged. Defaults to `private`, which logs this information. Set to `public` to redact this information.
13
+
-`SOURCEKITLSP_LOG_LEVEL`: When using `NonDarwinLogger`, specify the level at which messages should be logged. Defaults to `debug` in debug build and `default` in release builds. Primarily used to increase the log level when running tests from a release build in Swift CI. To adjust the logging on user devices, use the [Configuration file](Configuration%20File.md).
14
+
-`SOURCEKITLSP_LOG_PRIVACY_LEVEL`: When using `NonDarwinLogger`, specifies whether information that might contain sensitive information (essentially source code) should be logged. Defaults to `private` in debug build and `public`in release builds. Primarily used to log sensitive information when running tests from a release build in Swift CI. To adjust the logging on user devices, use the [Configuration file](Configuration%20File.md).
15
15
16
16
## Testing
17
17
-`SKIP_LONG_TESTS`: Skip tests that typically take more than 1s to execute.
0 commit comments