Skip to content

Commit

Permalink
Merge pull request #1081 from microsoft/isidorn/splendid-unicorn
Browse files Browse the repository at this point in the history
no need to check isUsageEnabled and isErrorsEnabled that is auto-checked
  • Loading branch information
isidorn authored Aug 2, 2024
2 parents 8429534 + 14d9a16 commit bc0c133
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions telemetry-sample/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,14 @@ export function activate(context: vscode.ExtensionContext) {

const c1 = vscode.commands.registerCommand('extension.logEvent', () => {
vscode.window.showInformationMessage('Logged telemetry event!');
if (logger.isUsageEnabled) {
logger.logUsage('testEvent', { 'testProp': 'testValue' });
}
logger.logUsage('testEvent', { 'testProp': 'testValue' });
});

context.subscriptions.push(c1);

context.subscriptions.push(vscode.commands.registerCommand('extension.logException', () => {
vscode.window.showInformationMessage('Logged telemetry exception!');
if (logger.isErrorsEnabled) {
logger.logError(new Error('Test'), { 'testProp': 'testValue' });
logger.logError('testerror', { 'testProp': 'testValue' });
}
logger.logError(new Error('Test'), { 'testProp': 'testValue' });
logger.logError('testerror', { 'testProp': 'testValue' });
}));
}

0 comments on commit bc0c133

Please sign in to comment.