Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add sf log level to current runtime #5444

Merged
merged 4 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions packages/salesforcedx-vscode-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -976,6 +976,14 @@
},
"salesforcedx-vscode-core.SF_LOG_LEVEL": {
"type": "string",
"enum": [
"trace",
"debug",
"info",
"warn",
"error",
"fatal"
],
"default": "fatal",
"description": "%sf_log_level_description%"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export class SfdxCoreSettings {
public getSfLogLevel(): string {
return this.getConfigValue(
ENV_SF_LOG_LEVEL,
process.env.SF_LOG_LEVEL ?? ''
process.env.SF_LOG_LEVEL ?? 'fatal'
);
}

Expand Down
27 changes: 14 additions & 13 deletions packages/salesforcedx-vscode-core/src/util/cliConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
import { nls } from '../messages';
import { sfdxCoreSettings } from '../settings';

export function isCLIInstalled(): boolean {
export const isCLIInstalled = () => {
let isInstalled = false;
try {
if (which('sfdx')) {
Expand All @@ -30,39 +30,40 @@ export function isCLIInstalled(): boolean {
console.error('An error happened while looking for sfdx cli', e);
}
return isInstalled;
}
};

export function showCLINotInstalledMessage() {
export const showCLINotInstalledMessage = () => {
const showMessage = nls.localize(
'salesforce_cli_not_found',
SF_CLI_DOWNLOAD_LINK,
SF_CLI_DOWNLOAD_LINK
);
window.showWarningMessage(showMessage);
}
void window.showWarningMessage(showMessage);
};

export function disableCLITelemetry() {
export const disableCLITelemetry = () => {
GlobalCliEnvironment.environmentVariables.set(
ENV_SF_DISABLE_TELEMETRY,
'true'
);
}
};

export async function isCLITelemetryAllowed() {
export const isCLITelemetryAllowed = async () => {
const isTelemetryDisabled = await ConfigUtil.isTelemetryDisabled();
return !isTelemetryDisabled;
}
};

export function setNodeExtraCaCerts() {
export const setNodeExtraCaCerts = () => {
GlobalCliEnvironment.environmentVariables.set(
ENV_NODE_EXTRA_CA_CERTS,
sfdxCoreSettings.getNodeExtraCaCerts()
);
}
};

export function setSfLogLevel() {
export const setSfLogLevel = () => {
GlobalCliEnvironment.environmentVariables.set(
ENV_SF_LOG_LEVEL,
sfdxCoreSettings.getSfLogLevel()
);
}
process.env[ENV_SF_LOG_LEVEL] = sfdxCoreSettings.getSfLogLevel();
};
Loading