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

Add setting to change Zowe Explorer logs folder #2189

Merged
merged 22 commits into from
Apr 14, 2023
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
3c6616c
Add setting to change Zowe Explorer logs folder
t1m0thyj Mar 16, 2023
6131f97
Update unit tests for custom logging path
t1m0thyj Mar 16, 2023
24df196
Remove unnecessary logger mock from uss tests
t1m0thyj Mar 16, 2023
abe6e3a
Handle VS Code API returning empty string
t1m0thyj Mar 17, 2023
d9c1d1e
Add error handling for missing write access to folders
t1m0thyj Mar 24, 2023
ec835a4
Don't log error if log failed to initialize
t1m0thyj Mar 24, 2023
5f7f6df
Update unit tests for logger initialization
t1m0thyj Mar 27, 2023
d581fb1
Merge branch 'main' into feature/logs-folder-setting
t1m0thyj Mar 27, 2023
89a5c20
Update changelogs
t1m0thyj Mar 27, 2023
575e9d7
Merge branch 'main' into feature/logs-folder-setting
t1m0thyj Mar 30, 2023
e46b273
Update logs path when setting is changed
t1m0thyj Mar 30, 2023
4127612
Add unit tests for loading profile security value
t1m0thyj Apr 3, 2023
e8eb2cb
Merge branch 'main' into feature/logs-folder-setting
t1m0thyj Apr 5, 2023
78cf27f
Resolve conflicts and update tests
t1m0thyj Apr 5, 2023
cd48674
polishing work
JillieBeanSim Apr 6, 2023
089b512
Fix failing unit tests
t1m0thyj Apr 6, 2023
134b0e1
remove console.logs
JillieBeanSim Apr 6, 2023
db6e995
addressed comments
JillieBeanSim Apr 6, 2023
b2bfaac
Merge pull request #2228 from zowe/logging-polish-work
t1m0thyj Apr 10, 2023
cef56a9
More polishing of logger util methods
t1m0thyj Apr 11, 2023
4694eb9
Merge branch 'main' into feature/logs-folder-setting
t1m0thyj Apr 11, 2023
5506150
Recursively create temp folder and improve error handling
t1m0thyj Apr 11, 2023
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
1 change: 1 addition & 0 deletions packages/zowe-explorer-api/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ All notable changes to the "zowe-explorer-api" extension will be documented in t

- Added `Gui.reportProgress` that can be used to notify users of action progress in conjunction with the `Gui.withProgress` call. [#2167](https://github.com/zowe/vscode-extension-for-zowe/issues/2167)
- Updated linter rules and addressed linter errors throughout the codebase. [#2184](https://github.com/zowe/vscode-extension-for-zowe/issues/2184)
- Added `ZoweVsCodeExtension.customLoggingPath` that can be used to get custom logging path defined in VS Code settings. [#2186](https://github.com/zowe/vscode-extension-for-zowe/issues/2186)

### Bug fixes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@ describe("ZoweVsCodeExtension", () => {
jest.clearAllMocks();
});

it("customLoggingPath should return value if defined in VS Code settings", () => {
const mockGetConfig = jest.fn().mockReturnValueOnce(__dirname);
jest.spyOn(vscode.workspace, "getConfiguration").mockReturnValue({
get: mockGetConfig,
} as unknown as vscode.WorkspaceConfiguration);
expect(ZoweVsCodeExtension.customLoggingPath).toBe(__dirname);
expect(ZoweVsCodeExtension.customLoggingPath).toBeUndefined();
expect(mockGetConfig).toHaveBeenCalledTimes(2);
});

describe("getZoweExplorerApi", () => {
it("should return client API", () => {
jest.spyOn(vscode.extensions, "getExtension").mockReturnValueOnce(fakeVsce);
Expand Down
7 changes: 7 additions & 0 deletions packages/zowe-explorer-api/src/vscode/ZoweVsCodeExtension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ export class ZoweVsCodeExtension {
return new ProfilesCache(imperative.Logger.getAppLogger(), vscode.workspace.workspaceFolders?.[0]?.uri.fsPath);
}

/**
* Get custom logging path if one is defined in VS Code settings.
*/
public static get customLoggingPath(): string | undefined {
return vscode.workspace.getConfiguration("zowe").get("files.logsFolder.path") || undefined;
}

/**
* @param {string} [requiredVersion] Optional semver string specifying the minimal required version
* of Zowe Explorer that needs to be installed for the API to be usable to the client.
Expand Down
1 change: 1 addition & 0 deletions packages/zowe-explorer-ftp-extension/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ All notable changes to the "vscode-extension-for-zowe" extension will be documen
### New features and enhancements

- Updated linter rules and addressed linter errors throughout the codebase. [#2184](https://github.com/zowe/vscode-extension-for-zowe/issues/2184)
- Added support for new setting `zowe.files.logsFolder.path` that can be used to override Zowe Explorer logs folder. [#2186](https://github.com/zowe/vscode-extension-for-zowe/issues/2186)

### Bug fixes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,12 @@ export namespace Gui {
}
}

export namespace ZoweVsCodeExtension {
export function getZoweExplorerApi(requiredVersion?: string): any {
export class ZoweVsCodeExtension {
public static get customLoggingPath(): string | undefined {
return undefined;
}

public static getZoweExplorerApi(requiredVersion?: string): any {
return {
registerUssApi: () => {},
registerJesApi: () => {},
Expand Down
2 changes: 1 addition & 1 deletion packages/zowe-explorer-ftp-extension/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { CoreUtils } from "@zowe/zos-ftp-for-zowe-cli";
import { imperative } from "@zowe/cli";
import { FtpSession } from "./ftpSession";

export const ZoweLogger = new IZoweLogger("Zowe Explorer FTP Extension", path.join(__dirname, "..", ".."));
export const ZoweLogger = new IZoweLogger("Zowe Explorer FTP Extension", ZoweVsCodeExtension.customLoggingPath ?? path.join(__dirname, "..", ".."));

export function activate(_context: vscode.ExtensionContext): void {
void registerFtpApis();
Expand Down
1 change: 1 addition & 0 deletions packages/zowe-explorer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ All notable changes to the "vscode-extension-for-zowe" extension will be documen

- Opening a dialog for Upload or Download of files will now open at the project level directory or the user's home directory if no project is opened. [#2203](https://github.com/zowe/vscode-extension-for-zowe/issues/2203)
- Updated linter rules and addressed linter errors throughout the codebase. [#2184](https://github.com/zowe/vscode-extension-for-zowe/issues/2184)
- Added a new setting `zowe.files.logsFolder.path` that can be used to override Zowe Explorer logs folder if default location is read-only. [#2186](https://github.com/zowe/vscode-extension-for-zowe/issues/2186)

### Bug fixes

Expand Down
21 changes: 18 additions & 3 deletions packages/zowe-explorer/__tests__/__unit__/shared/init.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,18 @@ describe("Test src/shared/extension", () => {
{
name: "onDidChangeConfiguration:1",
mock: [
{ spy: jest.spyOn(test.value, "affectsConfiguration"), arg: [globals.SETTINGS_LOGS_FOLDER_PATH], ret: true },
{ spy: jest.spyOn(globals, "initLogger"), arg: [test.value] },
{ spy: jest.spyOn(test.value, "affectsConfiguration"), arg: [globals.SETTINGS_TEMP_FOLDER_PATH], ret: false },
{ spy: jest.spyOn(test.value, "affectsConfiguration"), arg: [globals.SETTINGS_AUTOMATIC_PROFILE_VALIDATION], ret: false },
{ spy: jest.spyOn(test.value, "affectsConfiguration"), arg: [globals.SETTINGS_TEMP_FOLDER_HIDE], ret: false },
{ spy: jest.spyOn(test.value, "affectsConfiguration"), arg: [globals.SETTINGS_SECURE_CREDENTIALS_ENABLED], ret: false },
],
},
{
name: "onDidChangeConfiguration:2",
mock: [
{ spy: jest.spyOn(test.value, "affectsConfiguration"), arg: [globals.SETTINGS_LOGS_FOLDER_PATH], ret: false },
{ spy: jest.spyOn(test.value, "affectsConfiguration"), arg: [globals.SETTINGS_TEMP_FOLDER_PATH], ret: true },
{ spy: jest.spyOn(tempFolder, "moveTempFolder"), arg: [undefined, test.value] },
{ spy: jest.spyOn(test.value, "affectsConfiguration"), arg: [globals.SETTINGS_AUTOMATIC_PROFILE_VALIDATION], ret: false },
Expand All @@ -61,8 +73,9 @@ describe("Test src/shared/extension", () => {
],
},
{
name: "onDidChangeConfiguration:2",
name: "onDidChangeConfiguration:3",
mock: [
{ spy: jest.spyOn(test.value, "affectsConfiguration"), arg: [globals.SETTINGS_LOGS_FOLDER_PATH], ret: false },
{ spy: jest.spyOn(test.value, "affectsConfiguration"), arg: [globals.SETTINGS_TEMP_FOLDER_PATH], ret: false },
{ spy: jest.spyOn(test.value, "affectsConfiguration"), arg: [globals.SETTINGS_AUTOMATIC_PROFILE_VALIDATION], ret: true },
{ spy: jest.spyOn(Profiles, "getInstance"), arg: [], ret: { refresh: jest.fn() } },
Expand All @@ -74,8 +87,9 @@ describe("Test src/shared/extension", () => {
],
},
{
name: "onDidChangeConfiguration:3",
name: "onDidChangeConfiguration:4",
mock: [
{ spy: jest.spyOn(test.value, "affectsConfiguration"), arg: [globals.SETTINGS_LOGS_FOLDER_PATH], ret: false },
{ spy: jest.spyOn(test.value, "affectsConfiguration"), arg: [globals.SETTINGS_TEMP_FOLDER_PATH], ret: false },
{ spy: jest.spyOn(test.value, "affectsConfiguration"), arg: [globals.SETTINGS_AUTOMATIC_PROFILE_VALIDATION], ret: false },
{ spy: jest.spyOn(test.value, "affectsConfiguration"), arg: [globals.SETTINGS_TEMP_FOLDER_HIDE], ret: true },
Expand All @@ -84,8 +98,9 @@ describe("Test src/shared/extension", () => {
],
},
{
name: "onDidChangeConfiguration:4",
name: "onDidChangeConfiguration:5",
mock: [
{ spy: jest.spyOn(test.value, "affectsConfiguration"), arg: [globals.SETTINGS_LOGS_FOLDER_PATH], ret: false },
{ spy: jest.spyOn(test.value, "affectsConfiguration"), arg: [globals.SETTINGS_TEMP_FOLDER_PATH], ret: false },
{ spy: jest.spyOn(test.value, "affectsConfiguration"), arg: [globals.SETTINGS_AUTOMATIC_PROFILE_VALIDATION], ret: false },
{ spy: jest.spyOn(test.value, "affectsConfiguration"), arg: [globals.SETTINGS_TEMP_FOLDER_HIDE], ret: false },
Expand Down
22 changes: 2 additions & 20 deletions packages/zowe-explorer/__tests__/__unit__/uss/actions.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
jest.mock("fs");

import * as zowe from "@zowe/cli";
import { Gui, ProfilesCache, ValidProfileEnum } from "@zowe/zowe-explorer-api";
import { Gui, ValidProfileEnum } from "@zowe/zowe-explorer-api";
import * as ussNodeActions from "../../../src/uss/actions";
import { UssFileTree, UssFileType, UssFileUtils } from "../../../src/uss/FileStructure";
import { createUSSTree, createUSSNode, createFavoriteUSSNode } from "../../../__mocks__/mockCreators/uss";
Expand All @@ -23,7 +23,6 @@ import {
createTextDocument,
createFileResponse,
createValidIProfile,
createInstanceOfProfileInfo,
} from "../../../__mocks__/mockCreators/shared";
import { ZoweExplorerApiRegister } from "../../../src/ZoweExplorerApiRegister";
import { Profiles } from "../../../src/Profiles";
Expand Down Expand Up @@ -74,23 +73,11 @@ function createGlobalMocks() {
Notification: 15,
};
}),
mockProfileInfo: createInstanceOfProfileInfo(),
mockProfilesCache: new ProfilesCache(zowe.imperative.Logger.getAppLogger()),
};

globalMocks.mockLoadNamedProfile.mockReturnValue(globalMocks.testProfile);
// Mock the logger
globals.defineGlobals("/test/path/");
const extensionMock = jest.fn(
() =>
({
subscriptions: [],
extensionPath: path.join(__dirname, "..", ".."),
} as vscode.ExtensionContext)
);
const mock = new extensionMock();
globals.defineGlobals("");
const profilesForValidation = { status: "active", name: "fake" };
globals.initLogger(mock);

Object.defineProperty(Gui, "setStatusBarMessage", { value: globalMocks.setStatusBarMessage, configurable: true });
Object.defineProperty(vscode.window, "showInputBox", { value: globalMocks.mockShowInputBox, configurable: true });
Expand Down Expand Up @@ -168,11 +155,6 @@ function createGlobalMocks() {
};
}),
});
Object.defineProperty(globalMocks.mockProfilesCache, "getProfileInfo", {
value: jest.fn(() => {
return { value: globalMocks.mockProfileInfo, configurable: true };
}),
});

return globalMocks;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,50 @@
*
*/

import * as path from "path";
import * as LoggerUtils from "../../../src/utils/LoggerUtils";
import * as vscode from "vscode";
import * as globals from "../../../src/globals";
import { imperative } from "@zowe/cli";
Fixed Show fixed Hide fixed
import { Gui } from "@zowe/zowe-explorer-api";

describe("Logger Utils Unit Tests - function initializeZoweLogger", () => {
it("should reinitialize logger with new path", async () => {
const oldLogsPath = path.join("..", "logs1");
const newLogsPath = path.join("..", "logs2");
const initLoggerSpy = jest.spyOn(imperative.Logger, "initLogger").mockImplementation();

Object.defineProperty(globals, "LOG", {
value: {
debug: jest.fn(),
},
configurable: true,
});

await LoggerUtils.initializeZoweLogger({
subscriptions: [],
extensionPath: oldLogsPath,
} as unknown as vscode.ExtensionContext);
await LoggerUtils.initializeZoweLogger({
subscriptions: [],
extensionPath: newLogsPath,
} as unknown as vscode.ExtensionContext);

expect(initLoggerSpy).toHaveBeenCalledTimes(2);
const loggerConfig: Record<string, any> = initLoggerSpy.mock.calls[0][0];
expect(loggerConfig.log4jsConfig.appenders.default.filename.indexOf(oldLogsPath)).toBe(0);
const loggerConfig2: Record<string, any> = initLoggerSpy.mock.calls[1][0];
expect(loggerConfig2.log4jsConfig.appenders.default.filename.indexOf(oldLogsPath)).toBe(-1);
expect(loggerConfig2.log4jsConfig.appenders.default.filename.indexOf(newLogsPath)).toBe(0);
});

it("should throw an error if logger was not able to initialize", async () => {
jest.spyOn(globals, "initLogger").mockImplementation(() => {
throw new Error("failed to initialize logger");
});

Object.defineProperty(globals, "LOG", {
value: {
error: jest.fn(),
},
value: jest.fn(), // Mock logger to fail if called
configurable: true,
});

Expand All @@ -33,8 +62,9 @@ describe("Logger Utils Unit Tests - function initializeZoweLogger", () => {
LoggerUtils.initializeZoweLogger({
subscriptions: [],
extensionPath: "./test",
} as vscode.ExtensionContext)
} as unknown as vscode.ExtensionContext)
).resolves.toEqual(undefined);
expect(errorMessageSpy).toBeCalledTimes(1);
expect(globals.LOG).not.toHaveBeenCalled();
});
});
1 change: 1 addition & 0 deletions packages/zowe-explorer/i18n/sample/package.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
"zowe.ds.default.pds": "Default values of Partitioned data set creation",
"zowe.ds.default.ps": "Default values of Sequential data set creation",
"zowe.ds.history": "Toggle if favorite files persist locally",
"zowe.files.logsFolder.path": "Path to Zowe Explorer logs folder",
"zowe.files.temporaryDownloadsFolder.path": "Path to temporary folder location",
"zowe.uss.history": "Toggle if USS favorite files persist locally",
"zowe.jobs.history": "Toggle if Jobs favorite files persist locally",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"initialize.log.debug": "Initialized logger from VSCode extension",
"initialize.log.error": "Error encountered while activating and initializing logger! "
"initialize.log.error": "Error encountered while activating and initializing logger"
}
6 changes: 6 additions & 0 deletions packages/zowe-explorer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1696,6 +1696,12 @@
"description": "%zowe.ds.history%",
"scope": "application"
},
"zowe.files.logsFolder.path": {
"type": "string",
"default": "",
"description": "%zowe.files.logsFolder.path%",
"scope": "window"
},
"zowe.files.temporaryDownloadsFolder.path": {
"type": "string",
"default": "",
Expand Down
1 change: 1 addition & 0 deletions packages/zowe-explorer/package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
"zowe.ds.default.pds": "Default values of Partitioned data set creation",
"zowe.ds.default.ps": "Default values of Sequential data set creation",
"zowe.ds.history": "Toggle if favorite files persist locally",
"zowe.files.logsFolder.path": "Path to Zowe Explorer logs folder",
"zowe.files.temporaryDownloadsFolder.path": "Path to temporary folder location",
"zowe.uss.history": "Toggle if USS favorite files persist locally",
"zowe.jobs.history": "Toggle if Jobs favorite files persist locally",
Expand Down
20 changes: 11 additions & 9 deletions packages/zowe-explorer/src/globals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export const SETTINGS_VERSION = "zowe.settings.version";
export const SETTINGS_TEMP_FOLDER_PATH = "zowe.files.temporaryDownloadsFolder.path";
export const SETTINGS_TEMP_FOLDER_CLEANUP = "zowe.files.temporaryDownloadsFolder.cleanup";
export const SETTINGS_TEMP_FOLDER_HIDE = "zowe.files.temporaryDownloadsFolder.hide";
export const SETTINGS_LOGS_FOLDER_PATH = "zowe.files.logsFolder.path";
export const SETTINGS_DS_DEFAULT_BINARY = "zowe.ds.default.binary";
export const SETTINGS_DS_DEFAULT_C = "zowe.ds.default.c";
export const SETTINGS_DS_DEFAULT_CLASSIC = "zowe.ds.default.classic";
Expand Down Expand Up @@ -306,16 +307,17 @@ export function setConfigPath(configPath: string | undefined): void {

/**
* Initializes Imperative Logger
* @param context The extension context
* @param logsPath File path for logs folder defined in preferences
*/
export function initLogger(context: vscode.ExtensionContext): void {
for (const appenderName of Object.keys(loggerConfig.log4jsConfig.appenders)) {
loggerConfig.log4jsConfig.appenders[appenderName].filename = path.join(
context.extensionPath,
loggerConfig.log4jsConfig.appenders[appenderName].filename
export function initLogger(logsPath: string): void {
const loggerConfigCopy = JSON.parse(JSON.stringify(loggerConfig));
for (const appenderName of Object.keys(loggerConfigCopy.log4jsConfig.appenders)) {
loggerConfigCopy.log4jsConfig.appenders[appenderName].filename = path.join(
logsPath,
loggerConfigCopy.log4jsConfig.appenders[appenderName].filename
);
}
imperative.Logger.initLogger(loggerConfig);
imperative.Logger.initLogger(loggerConfigCopy);
this.LOG = imperative.Logger.getAppLogger();
}

Expand All @@ -330,10 +332,10 @@ export function setSavedProfileContents(value: Uint8Array): void {
export async function setGlobalSecurityValue(): Promise<void> {
if (ISTHEIA) {
PROFILE_SECURITY = false;
await SettingsConfig.setDirectValue(this.SETTINGS_SECURE_CREDENTIALS_ENABLED, false, vscode.ConfigurationTarget.Global);
await SettingsConfig.setDirectValue(SETTINGS_SECURE_CREDENTIALS_ENABLED, false, vscode.ConfigurationTarget.Global);
return;
}
const settingEnabled: boolean = SettingsConfig.getDirectValue(this.SETTINGS_SECURE_CREDENTIALS_ENABLED);
const settingEnabled: boolean = SettingsConfig.getDirectValue(SETTINGS_SECURE_CREDENTIALS_ENABLED);
if (!settingEnabled) {
PROFILE_SECURITY = false;
} else {
Expand Down
10 changes: 6 additions & 4 deletions packages/zowe-explorer/src/shared/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { saveFile } from "../dataset/actions";
import { saveUSSFile } from "../uss/actions";
import { promptCredentials, writeOverridesFile } from "../utils/ProfilesUtils";
import { ZoweSaveQueue } from "../abstract/ZoweSaveQueue";
import { initializeZoweLogger } from "../utils/LoggerUtils";

// Set up localization
nls.config({
Expand Down Expand Up @@ -82,12 +83,13 @@ export function registerCommonCommands(context: vscode.ExtensionContext, provide
// Register functions & event listeners
context.subscriptions.push(
vscode.workspace.onDidChangeConfiguration(async (e) => {
// If the log folder location has been changed, update current log folder preference
if (e.affectsConfiguration(globals.SETTINGS_LOGS_FOLDER_PATH)) {
await initializeZoweLogger(context);
Fixed Show fixed Hide fixed
}
// If the temp folder location has been changed, update current temp folder preference
if (e.affectsConfiguration(globals.SETTINGS_TEMP_FOLDER_PATH)) {
const updatedPreferencesTempPath: string = vscode.workspace
.getConfiguration()
/* tslint:disable:no-string-literal */
.get(globals.SETTINGS_TEMP_FOLDER_PATH);
const updatedPreferencesTempPath: string = vscode.workspace.getConfiguration().get(globals.SETTINGS_TEMP_FOLDER_PATH);
moveTempFolder(globals.SETTINGS_TEMP_FOLDER_LOCATION, updatedPreferencesTempPath);
}
if (e.affectsConfiguration(globals.SETTINGS_AUTOMATIC_PROFILE_VALIDATION)) {
Expand Down
9 changes: 5 additions & 4 deletions packages/zowe-explorer/src/utils/LoggerUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*
*/

import { Gui } from "@zowe/zowe-explorer-api";
import { Gui, ZoweVsCodeExtension } from "@zowe/zowe-explorer-api";
import * as vscode from "vscode";
import * as nls from "vscode-nls";
import * as globals from "../globals";
Expand All @@ -23,12 +23,13 @@ const localize: nls.LocalizeFunc = nls.loadMessageBundle();

export async function initializeZoweLogger(context: vscode.ExtensionContext): Promise<void> {
try {
globals.initLogger(context);
const logsPath: string = ZoweVsCodeExtension.customLoggingPath ?? context.extensionPath;
globals.initLogger(logsPath);
globals.LOG.debug(localize("initialize.log.debug", "Initialized logger from VSCode extension"));
} catch (err) {
globals.LOG.error(err);
const errorMessage = localize("initialize.log.error", "Error encountered while activating and initializing logger! ");
// Don't log error if logger failed to initialize
if (err instanceof Error) {
const errorMessage = localize("initialize.log.error", "Error encountered while activating and initializing logger");
await Gui.errorMessage(`${errorMessage}: ${err.message}`);
}
}
Expand Down