Skip to content

Commit 001abb1

Browse files
authored
remote tunnel: extract log from LogOutputChannels & EnvService (microsoft#166597)
1 parent dff6f56 commit 001abb1

File tree

8 files changed

+16
-19
lines changed

8 files changed

+16
-19
lines changed

src/vs/platform/environment/common/environment.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,6 @@ export interface IEnvironmentService {
6969
editSessionId?: string;
7070
editSessionsLogResource: URI;
7171

72-
// remote tunnel
73-
remoteTunnelLogResource: URI;
74-
7572
// --- extension development
7673
debugExtensionHost: IExtensionHostDebugParams;
7774
isExtensionDevelopment: boolean;

src/vs/platform/environment/common/environmentService.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,6 @@ export abstract class AbstractNativeEnvironmentService implements INativeEnviron
8585
@memoize
8686
get editSessionsLogResource(): URI { return URI.file(join(this.logsPath, 'editSessions.log')); }
8787

88-
@memoize
89-
get remoteTunnelLogResource(): URI { return URI.file(join(this.logsPath, 'remoteTunnel.log')); }
90-
9188
@memoize
9289
get sync(): 'on' | 'off' | undefined { return this.args.sync; }
9390

src/vs/platform/remoteTunnel/common/remoteTunnel.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
77
import { Event } from 'vs/base/common/event';
88

9-
109
export interface IRemoteTunnelAccount {
1110
readonly authenticationProviderId: string;
1211
readonly token: string;
@@ -61,3 +60,7 @@ export interface ConnectionInfo {
6160

6261
export const CONFIGURATION_KEY_PREFIX = 'remote.tunnels.access';
6362
export const CONFIGURATION_KEY_HOST_NAME = CONFIGURATION_KEY_PREFIX + '.hostNameOverride';
63+
64+
export const LOG_FILE_NAME = 'remoteTunnelService.log';
65+
export const LOGGER_NAME = 'remoteTunnelService';
66+
export const LOG_CHANNEL_ID = 'remoteTunnelServiceLog';

src/vs/platform/remoteTunnel/electron-browser/remoteTunnelService.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { CONFIGURATION_KEY_HOST_NAME, ConnectionInfo, IRemoteTunnelAccount, IRemoteTunnelService, TunnelStates, TunnelStatus } from 'vs/platform/remoteTunnel/common/remoteTunnel';
6+
import { CONFIGURATION_KEY_HOST_NAME, ConnectionInfo, IRemoteTunnelAccount, IRemoteTunnelService, LOGGER_NAME, LOG_FILE_NAME, TunnelStates, TunnelStatus } from 'vs/platform/remoteTunnel/common/remoteTunnel';
77
import { Emitter } from 'vs/base/common/event';
88
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
99
import { INativeEnvironmentService } from 'vs/platform/environment/common/environment';
@@ -18,6 +18,7 @@ import { ISharedProcessLifecycleService } from 'vs/platform/lifecycle/electron-b
1818
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
1919
import { localize } from 'vs/nls';
2020
import { hostname, homedir } from 'os';
21+
import { URI } from 'vs/base/common/uri';
2122

2223
type RemoteTunnelEnablementClassification = {
2324
owner: 'aeschli';
@@ -65,7 +66,8 @@ export class RemoteTunnelService extends Disposable implements IRemoteTunnelServ
6566
@IConfigurationService private readonly configurationService: IConfigurationService
6667
) {
6768
super();
68-
this._logger = this._register(loggerService.createLogger(environmentService.remoteTunnelLogResource, { name: 'remoteTunnel' }));
69+
const remoteTunnelLogResource = URI.file(join(environmentService.logsPath, LOG_FILE_NAME));
70+
this._logger = this._register(loggerService.createLogger(remoteTunnelLogResource, { name: LOGGER_NAME }));
6971
this._startTunnelProcessDelayer = new Delayer(100);
7072

7173
this._register(sharedProcessLifecycleService.onWillShutdown(e => {

src/vs/workbench/contrib/logs/common/logConstants.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ export const telemetryLogChannelId = 'telemetryLog';
1010
export const extensionTelemetryLogChannelId = 'extensionTelemetryLog';
1111
export const userDataSyncLogChannelId = 'userDataSyncLog';
1212
export const editSessionsLogChannelId = 'editSessionsSyncLog';
13-
export const remoteTunnelLogChannelId = 'remoteTunnelLog';
1413
export const remoteServerLog = 'remoteServerLog';
1514
export const remotePtyHostLog = 'remotePtyHostLog';
1615

src/vs/workbench/contrib/logs/common/logs.contribution.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ class LogOutputChannels extends Disposable implements IWorkbenchContribution {
5050
private registerCommonContributions(): void {
5151
this.registerLogChannel(Constants.userDataSyncLogChannelId, nls.localize('userDataSyncLog', "Settings Sync"), this.environmentService.userDataSyncLogResource);
5252
this.registerLogChannel(Constants.editSessionsLogChannelId, nls.localize('editSessionsLog', "Edit Sessions"), this.environmentService.editSessionsLogResource);
53-
this.registerLogChannel(Constants.remoteTunnelLogChannelId, nls.localize('remoteTunnelLog', "Remote Tunnel"), this.environmentService.remoteTunnelLogResource);
5453
this.registerLogChannel(Constants.rendererLogChannelId, nls.localize('rendererLog', "Window"), this.environmentService.logFile);
5554

5655
const registerTelemetryChannel = () => {

src/vs/workbench/contrib/remoteTunnel/electron-sandbox/remoteTunnel.contribution.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import { Disposable, DisposableStore } from 'vs/base/common/lifecycle';
77
import { Action2, MenuId, registerAction2 } from 'vs/platform/actions/common/actions';
88
import { IProductService } from 'vs/platform/product/common/productService';
9-
import { CONFIGURATION_KEY_HOST_NAME, CONFIGURATION_KEY_PREFIX, ConnectionInfo, IRemoteTunnelService } from 'vs/platform/remoteTunnel/common/remoteTunnel';
9+
import { CONFIGURATION_KEY_HOST_NAME, CONFIGURATION_KEY_PREFIX, ConnectionInfo, IRemoteTunnelService, LOGGER_NAME, LOG_CHANNEL_ID, LOG_FILE_NAME } from 'vs/platform/remoteTunnel/common/remoteTunnel';
1010
import { AuthenticationSession, AuthenticationSessionsChangeEvent, IAuthenticationService } from 'vs/workbench/services/authentication/common/authentication';
1111
import { localize } from 'vs/nls';
1212
import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions, IWorkbenchContribution } from 'vs/workbench/common/contributions';
@@ -21,7 +21,7 @@ import { INativeEnvironmentService } from 'vs/platform/environment/common/enviro
2121
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
2222
import { IStringDictionary } from 'vs/base/common/collections';
2323
import { IQuickInputService, IQuickPickItem, IQuickPickSeparator, QuickPickItem } from 'vs/platform/quickinput/common/quickInput';
24-
import { IOutputService } from 'vs/workbench/services/output/common/output';
24+
import { IOutputService, registerLogChannel } from 'vs/workbench/services/output/common/output';
2525
import { IFileService } from 'vs/platform/files/common/files';
2626
import { IConfigurationRegistry, Extensions as ConfigurationExtensions, ConfigurationScope } from 'vs/platform/configuration/common/configurationRegistry';
2727
import { IProgress, IProgressService, IProgressStep, ProgressLocation } from 'vs/platform/progress/common/progress';
@@ -32,11 +32,11 @@ import { IPreferencesService } from 'vs/workbench/services/preferences/common/pr
3232
import { IOpenerService } from 'vs/platform/opener/common/opener';
3333
import { Action } from 'vs/base/common/actions';
3434
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
35-
import * as Constants from 'vs/workbench/contrib/logs/common/logConstants';
3635
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
3736
import { Schemas } from 'vs/base/common/network';
3837
import { URI } from 'vs/base/common/uri';
3938
import { joinPath } from 'vs/base/common/resources';
39+
import { join } from 'vs/base/common/path';
4040

4141
export const REMOTE_TUNNEL_CATEGORY: ILocalizedString = {
4242
original: 'Remote Tunnels',
@@ -106,7 +106,9 @@ export class RemoteTunnelWorkbenchContribution extends Disposable implements IWo
106106
) {
107107
super();
108108

109-
this.logger = this._register(loggerService.createLogger(environmentService.remoteTunnelLogResource, { name: 'remoteTunnel' }));
109+
const remoteTunnelServiceLogResource = URI.file(join(environmentService.logsPath, LOG_FILE_NAME));
110+
111+
this.logger = this._register(loggerService.createLogger(remoteTunnelServiceLogResource, { name: LOGGER_NAME }));
110112

111113
this.connectionStateContext = REMOTE_TUNNEL_CONNECTION_STATE.bindTo(this.contextKeyService);
112114

@@ -153,6 +155,7 @@ export class RemoteTunnelWorkbenchContribution extends Disposable implements IWo
153155
this.initialize(true);
154156
}
155157

158+
registerLogChannel(LOG_CHANNEL_ID, localize('remoteTunnelLog', "Remote Tunnel Service"), remoteTunnelServiceLogResource, fileService, logService);
156159
}
157160

158161
private get existingSessionId() {
@@ -542,7 +545,7 @@ export class RemoteTunnelWorkbenchContribution extends Disposable implements IWo
542545

543546
async run(accessor: ServicesAccessor) {
544547
const outputService = accessor.get(IOutputService);
545-
outputService.showChannel(Constants.remoteTunnelLogChannelId);
548+
outputService.showChannel(LOG_CHANNEL_ID);
546549
}
547550
}));
548551

src/vs/workbench/services/environment/browser/environmentService.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,6 @@ export class BrowserWorkbenchEnvironmentService implements IBrowserWorkbenchEnvi
111111
@memoize
112112
get editSessionsLogResource(): URI { return joinPath(this.logsHome, 'editSessions.log'); }
113113

114-
@memoize
115-
get remoteTunnelLogResource(): URI { return joinPath(this.logsHome, 'remoteTunnel.log'); }
116-
117114
@memoize
118115
get sync(): 'on' | 'off' | undefined { return undefined; }
119116

0 commit comments

Comments
 (0)