(categoriesToLog: LogCategory[])
| 64 | } |
| 65 | |
| 66 | private async startLogging(categoriesToLog: LogCategory[]): Promise<string | undefined> { |
| 67 | const logFilename = path.join(forceWindowsDriveLetterToUppercase(this.extensionLogPath), this.generateFilename()); |
| 68 | const logUri = vs.Uri.file(logFilename); |
| 69 | createFolderForFile(logFilename); |
| 70 | |
| 71 | const allLoggedCategories = [LogCategory.General].concat(categoriesToLog); |
| 72 | |
| 73 | const logger = captureLogs(this.logger, fsPath(logUri), getLogHeader(), captureLogsMaxLineLength, allLoggedCategories); |
| 74 | isLogging = true; |
| 75 | this.onCaptureLogsEmitter.fire(isLogging); |
| 76 | this.disposables.push(logger); |
| 77 | void vs.commands.executeCommand("setContext", DART_IS_CAPTURING_LOGS_CONTEXT, true); |
| 78 | const completer = new PromiseCompleter<void>(); |
| 79 | this.currentLogCompleter = completer; |
| 80 | |
| 81 | await vs.window.withProgress( |
| 82 | { |
| 83 | cancellable: true, |
| 84 | location: vs.ProgressLocation.Notification, |
| 85 | title: `Dart and Flutter logs are being captured. Reproduce your issue then click Cancel.`, |
| 86 | }, |
| 87 | (_, token) => { |
| 88 | token.onCancellationRequested(() => completer.resolve()); |
| 89 | return completer.promise; |
| 90 | }, |
| 91 | ); |
| 92 | |
| 93 | isLogging = false; |
| 94 | this.onCaptureLogsEmitter.fire(isLogging); |
| 95 | await logger.dispose(); |
| 96 | |
| 97 | const doc = await vs.workspace.openTextDocument(logUri); |
| 98 | await vs.window.showTextDocument(doc); |
| 99 | |
| 100 | return logFilename; |
| 101 | } |
| 102 | |
| 103 | private async openExtensionLog(): Promise<void> { |
| 104 | const doc = await vs.workspace.openTextDocument(vs.Uri.file(getExtensionLogPath())); |
no test coverage detected