Skip to content
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
2 changes: 1 addition & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ let client: LanguageClient;

export async function activate(context: vscode.ExtensionContext) {
ext.context = context;
ext.outputChannel = vscode.window.createOutputChannel("kdb");
ext.outputChannel = vscode.window.createOutputChannel("kdb", { log: true });
ext.openSslVersion = await checkOpenSslInstalled();

getWorkspaceLabelsConnMap();
Expand Down
3 changes: 2 additions & 1 deletion src/extensionVariables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
ExtensionContext,
extensions,
languages,
LogOutputChannel,
OutputChannel,
StatusBarItem,
TextEditor,
Expand Down Expand Up @@ -49,7 +50,7 @@ export namespace ext {
export const REPL = "REPL";
export let activeTextEditor: TextEditor | undefined;
export let context: ExtensionContext;
export let outputChannel: OutputChannel;
export let outputChannel: LogOutputChannel;
export let consolePanel: OutputChannel;
export let serverProvider: KdbTreeProvider;
export let queryHistoryProvider: QueryHistoryProvider;
Expand Down
35 changes: 29 additions & 6 deletions src/utils/loggers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,35 @@ export function kdbOutputLog(
type: string,
supressDialog?: boolean,
): void {
const dateNow = new Date().toLocaleDateString();
const timeNow = new Date().toLocaleTimeString();
ext.outputChannel.appendLine(`[${dateNow} ${timeNow}] [${type}] ${message}`);
/* c8 ignore start */
switch (type) {
case "DEBUG":
ext.outputChannel.debug(message);
break;
case "INFO":
ext.outputChannel.info(message);
break;
case "WARNING":
ext.outputChannel.warn(message);
break;
case "ERROR":
ext.outputChannel.error(message);
break;
default:
ext.outputChannel.trace(message);
break;
}
if (type === "ERROR" && !supressDialog) {
vscode.window.showErrorMessage(
`Error occured, check kdb output channel for details.`,
);
vscode.window
.showErrorMessage(
`Error occured, check kdb output log for details.`,
"Check",
)
.then((res) => {
if (res === "Check") {
ext.outputChannel.show(true);
}
});
/* c8 ignore stop */
}
}
4 changes: 2 additions & 2 deletions test/suite/commands/dataSourceCommand.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import * as queryUtils from "../../../src/utils/queryUtils";
describe("dataSourceCommand", () => {
let dummyDataSourceFiles: DataSourceFiles;
let _resultsPanel: KdbResultsViewProvider;
ext.outputChannel = vscode.window.createOutputChannel("kdb");
ext.outputChannel = vscode.window.createOutputChannel("kdb", { log: true });
const localConn = new LocalConnection("localhost:5001", "test", []);
const insightsNode = new InsightsNode(
[],
Expand Down Expand Up @@ -731,7 +731,7 @@ describe("dataSourceCommand", () => {
writeQueryResultsToConsoleStub: sinon.SinonStub;
let windowMock: sinon.SinonMock;

ext.outputChannel = vscode.window.createOutputChannel("kdb");
ext.outputChannel = vscode.window.createOutputChannel("kdb", { log: true });

beforeEach(() => {
retrieveConnStub = sinon.stub(
Expand Down
2 changes: 1 addition & 1 deletion test/suite/utils/core.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ describe("core", () => {

/* eslint-disable @typescript-eslint/no-unused-expressions */
describe("coreLogs", () => {
ext.outputChannel = vscode.window.createOutputChannel("kdb");
ext.outputChannel = vscode.window.createOutputChannel("kdb", { log: true });
let appendLineSpy, showErrorMessageSpy: sinon.SinonSpy;
beforeEach(() => {
appendLineSpy = sinon.spy(
Expand Down
254 changes: 0 additions & 254 deletions test/suite/utils/loggers.test.ts

This file was deleted.