Skip to content

Commit

Permalink
Add output channel for telemetry.log file (microsoft#58846)
Browse files Browse the repository at this point in the history
* Add output channel for telemetry.log file

* Explain telemetry.log file in the first line
  • Loading branch information
ramya-rao-a authored Sep 20, 2018
1 parent 96033fe commit c0d1f91
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ function main(server: Server, initData: ISharedProcessInitData, configuration: I
const environmentService = accessor.get(IEnvironmentService);
const { appRoot, extensionsPath, extensionDevelopmentLocationURI, isBuilt, installSourcePath } = environmentService;
const telemetryLogService = new FollowerLogService(logLevelClient, createSpdLogService('telemetry', initData.logLevel, environmentService.logsPath));
telemetryLogService.info('The below are logs for every telemetry event sent from VS Code once the log level is set to trace.');
telemetryLogService.info('===========================================================');

let appInsightsAppender: ITelemetryAppender = NullAppender;
if (product.aiConfig && product.aiConfig.asimovKey && isBuilt) {
Expand Down
3 changes: 2 additions & 1 deletion src/vs/workbench/parts/logs/common/logConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
export const mainLogChannelId = 'mainLog';
export const sharedLogChannelId = 'sharedLog';
export const rendererLogChannelId = 'rendererLog';
export const extHostLogChannelId = 'extHostLog';
export const extHostLogChannelId = 'extHostLog';
export const telemetryLogChannelId = 'telemetryLog';
10 changes: 10 additions & 0 deletions src/vs/workbench/parts/logs/electron-browser/logs.contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,29 @@ import * as Constants from 'vs/workbench/parts/logs/common/logConstants';
import { IWorkbenchActionRegistry, Extensions as WorkbenchActionExtensions } from 'vs/workbench/common/actions';
import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
import { OpenLogsFolderAction, SetLogLevelAction } from 'vs/workbench/parts/logs/electron-browser/logsActions';
import { ILogService, LogLevel } from 'vs/platform/log/common/log';

class LogOutputChannels extends Disposable implements IWorkbenchContribution {

constructor(
@IWindowService windowService: IWindowService,
@IEnvironmentService environmentService: IEnvironmentService,
@ILogService logService: ILogService
) {
super();
let outputChannelRegistry = Registry.as<IOutputChannelRegistry>(OutputExt.OutputChannels);
outputChannelRegistry.registerChannel({ id: Constants.mainLogChannelId, label: nls.localize('mainLog', "Main"), file: URI.file(join(environmentService.logsPath, `main.log`)), log: true });
outputChannelRegistry.registerChannel({ id: Constants.sharedLogChannelId, label: nls.localize('sharedLog', "Shared"), file: URI.file(join(environmentService.logsPath, `sharedprocess.log`)), log: true });
outputChannelRegistry.registerChannel({ id: Constants.rendererLogChannelId, label: nls.localize('rendererLog', "Window"), file: URI.file(join(environmentService.logsPath, `renderer${windowService.getCurrentWindowId()}.log`)), log: true });

const registerTelemetryChannel = (level) => {
if (level === LogLevel.Trace && !outputChannelRegistry.getChannel(Constants.telemetryLogChannelId)) {
outputChannelRegistry.registerChannel({ id: Constants.telemetryLogChannelId, label: nls.localize('telemetryLog', "Telemetry"), file: URI.file(join(environmentService.logsPath, `telemetry.log`)), log: true });
}
};
registerTelemetryChannel(logService.getLevel());
logService.onDidChangeLogLevel(registerTelemetryChannel);

const workbenchActionsRegistry = Registry.as<IWorkbenchActionRegistry>(WorkbenchActionExtensions.WorkbenchActions);
const devCategory = nls.localize('developer', "Developer");
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(OpenLogsFolderAction, OpenLogsFolderAction.ID, OpenLogsFolderAction.LABEL), 'Developer: Open Log Folder', devCategory);
Expand Down

0 comments on commit c0d1f91

Please sign in to comment.