Skip to content

Commit

Permalink
Add fileLogging launch.json option (#487)
Browse files Browse the repository at this point in the history
* Add fileLogging launch.json optoin

* Add telemetry tracking for logfilePath

* roku-debug@0.19.0
  • Loading branch information
TwitchBronBron committed Jun 1, 2023
1 parent 7eff981 commit cd05e1e
Show file tree
Hide file tree
Showing 4 changed files with 139 additions and 11 deletions.
20 changes: 11 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

122 changes: 121 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"node-ssdp": "^4.0.0",
"postman-request": "^2.88.1-postman.32",
"pretty-bytes": "^5.6.0",
"roku-debug": "^0.18.12",
"roku-debug": "^0.19.0",
"roku-deploy": "^3.10.2",
"roku-test-automation": "^2.0.0-beta.19",
"semver": "^7.1.3",
Expand Down Expand Up @@ -511,6 +511,123 @@
]
}
},
"fileLogging": {
"oneOf": [
{
"type": "object",
"description": "Configure file logging for debug console logs as well as RokuCommunity debugger logs",
"default": {
"dir": "${workspaceFolder}/logs",
"rokuDevice": {
"enabled": true,
"filename": "rokuDevice.log",
"mode": "session",
"logLimit": 5
},
"debugger": {
"enabled": true,
"filename": "debugger.log",
"mode": "session",
"logLimit": 5
}
},
"properties": {
"enabled": {
"type": "boolean",
"description": "Should file logging be enabled"
},
"dir": {
"type": "string",
"description": "Directory where log files should be stored. used when filename is relative",
"default": "${workspaceFolder}/logs"
},
"logLimit": {
"type": "number",
"description": "The number of log files to keep. `null` means keep all logs",
"default": null
},
"rokuDevice": {
"oneOf": [
{
"type": "object",
"description": "File logging for the telnet or IO output from the Roku device currently being debugged. (i.e. all the stuff produced by `print` statements in your code)",
"properties": {
"enabled": {
"type": "boolean",
"description": "Should file logging be enabled"
},
"dir": {
"type": "string",
"description": "Directory where log files should be stored. used when filename is relative",
"default": "${workspaceFolder}/logs"
},
"logLimit": {
"type": "number",
"description": "The number of log files to keep. `null` means keep all logs",
"default": null
},
"mode": {
"type": "string",
"description": "`'session'` means a unique timestamped file will be created on every debug session.`'append'` means all logs will be appended to a single file",
"default": "session",
"enum": [
"session",
"append"
]
}
}
},
{
"type": "boolean",
"description": "Enable file logging for debug console logs as well as RokuCommunity debugger logs"
}
]
},
"debugger": {
"oneOf": [
{
"type": "object",
"description": "File logging for the debugger. Mostly used to provide crash logs to the RokuCommunity team.",
"properties": {
"enabled": {
"type": "boolean",
"description": "Should file logging be enabled"
},
"dir": {
"type": "string",
"description": "Directory where log files should be stored. used when filename is relative",
"default": "${workspaceFolder}/logs"
},
"logLimit": {
"type": "number",
"description": "The number of log files to keep. `null` means keep all logs",
"default": null
},
"mode": {
"type": "string",
"description": "`'session'` means a unique timestamped file will be created on every debug session.`'append'` means all logs will be appended to a single file",
"default": "session",
"enum": [
"session",
"append"
]
}
}
},
{
"type": "boolean",
"description": "Enable file logging for debug console logs as well as RokuCommunity debugger logs"
}
]
}
}
},
{
"type": "boolean",
"description": "Enable file logging for debug console logs as well as RokuCommunity debugger logs"
}
]
},
"outDir": {
"type": "string",
"description": "The folder where the the build artifacts are placed (like the staging folder and .zip files of the apps)",
Expand Down Expand Up @@ -650,6 +767,7 @@
},
"logfilePath": {
"type": "string",
"deprecationMessage": "Use `fileLogging` option instead",
"description": "A path to a file where all brightscript console output will be written. If null or empty, file logging will be disabled."
},
"enableDebugProtocol": {
Expand Down Expand Up @@ -1655,6 +1773,7 @@
},
"brightscript.debug.logfilePath": {
"type": "string",
"deprecationMessage": "Use `fileLogging` option instead",
"description": "A path to a file where all brightscript console output will be written. If null or empty, file logging will be disabled.",
"scope": "resource"
},
Expand Down Expand Up @@ -2023,6 +2142,7 @@
"properties": {
"brightscript.extensionLogfilePath": {
"type": "string",
"deprecationMessage": "Use `fileLogging` option instead",
"description": "File where the 'BrightScript Extension' output panel (i.e. debug logs for the extension) will be appended. If omitted, no file logging will be done. ${workspaceFolder} is supported and will point to the first workspace found.",
"scope": "resource"
}
Expand Down
1 change: 1 addition & 0 deletions src/DebugConfigurationProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ export class BrightScriptDebugConfigurationProvider implements DebugConfiguratio
config.remotePort = config.remotePort ? config.remotePort : this.configDefaults.remotePort;
config.logfilePath ??= null;
config.enableDebugProtocol = config.enableDebugProtocol ? true : false;
config.cwd = folderUri.fsPath;

if (config.request !== 'launch') {
await vscode.window.showErrorMessage(`roku-debug only supports the 'launch' request type`);
Expand Down
7 changes: 6 additions & 1 deletion src/managers/TelemetryManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import TelemetryReporter from '@vscode/extension-telemetry';
import type { Disposable } from 'vscode';
import type { BrightScriptLaunchConfiguration } from '../DebugConfigurationProvider';
import type { RemoteControlModeInitiator } from './RemoteControlManager';
import * as vscode from 'vscode';

const APP_INSIGHTS_KEY = '8618f206-4732-4729-88ed-d07dcf17f199';

Expand Down Expand Up @@ -40,7 +41,11 @@ export class TelemetryManager implements Disposable {
isPreLaunchTaskDefined: isDefined(event.preLaunchTask),
isComponentLibrariesDefined: isDefined(event.componentLibraries),
isDeepLinkUrlDefined: isDefined(event.deepLinkUrl),
isStagingFolderPathDefined: isDefined(event.stagingFolderPath)
isStagingFolderPathDefined: isDefined(event.stagingFolderPath),
isLogfilePathDefined: isDefined(event.logfilePath),
isExtensionLogfilePathDefined: isDefined(
vscode.workspace.getConfiguration('brightscript').get<string>('extensionLogfilePath')
)
});
}

Expand Down

0 comments on commit cd05e1e

Please sign in to comment.