Move show and log functions to common
This moves the `showAndLog` family of functions to the `common/logging` directory. It explicitly moves the `showAndLogExceptionWithTelemetry` function to the `common/vscode/logging.ts` file because it still has a dependency on the `telemetryListener`, which depends on the `vscode` module.
This commit is contained in:
@@ -25,7 +25,7 @@ import {
|
||||
import {
|
||||
showAndLogErrorMessage,
|
||||
showAndLogWarningMessage,
|
||||
} from "../common/vscode/log";
|
||||
} from "../common/logging";
|
||||
|
||||
/**
|
||||
* distribution.ts
|
||||
|
||||
@@ -4,7 +4,7 @@ import { isQueryLanguage, QueryLanguage } from "../common/query-language";
|
||||
import { getOnDiskWorkspaceFolders } from "../common/vscode/workspace-folders";
|
||||
import { extLogger } from "../common";
|
||||
import { UserCancellationException } from "../common/vscode/progress";
|
||||
import { showAndLogErrorMessage } from "../common/vscode/log";
|
||||
import { showAndLogErrorMessage } from "../common/logging";
|
||||
|
||||
/**
|
||||
* Finds the language that a query targets.
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
export * from "./logger";
|
||||
export * from "./notification-logger";
|
||||
export * from "./notifications";
|
||||
export * from "./tee-logger";
|
||||
export * from "./vscode/loggers";
|
||||
export * from "./vscode/output-channel-logger";
|
||||
|
||||
@@ -1,13 +1,6 @@
|
||||
import { RedactableError } from "../../pure/errors";
|
||||
import { telemetryListener } from "../../telemetry";
|
||||
import { NotificationLogger } from "../logging";
|
||||
import { NotificationLogger } from "./notification-logger";
|
||||
|
||||
interface ShowAndLogExceptionOptions extends ShowAndLogOptions {
|
||||
/** Custom properties to include in the telemetry report. */
|
||||
extraTelemetryProperties?: { [key: string]: string };
|
||||
}
|
||||
|
||||
interface ShowAndLogOptions {
|
||||
export interface ShowAndLogOptions {
|
||||
/**
|
||||
* An alternate message that is added to the log, but not displayed in the popup.
|
||||
* This is useful for adding extra detail to the logs that would be too noisy for the popup.
|
||||
@@ -15,24 +8,6 @@ interface ShowAndLogOptions {
|
||||
fullMessage?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show an error message, log it to the console, and emit redacted information as telemetry
|
||||
*
|
||||
* @param logger The logger that will receive the message.
|
||||
* @param error The error to show. Only redacted information will be included in the telemetry.
|
||||
* @param options See individual fields on `ShowAndLogExceptionOptions` type.
|
||||
*
|
||||
* @return A promise that resolves to the selected item or undefined when being dismissed.
|
||||
*/
|
||||
export async function showAndLogExceptionWithTelemetry(
|
||||
logger: NotificationLogger,
|
||||
error: RedactableError,
|
||||
options: ShowAndLogExceptionOptions = {},
|
||||
): Promise<void> {
|
||||
telemetryListener?.sendError(error, options.extraTelemetryProperties);
|
||||
return showAndLogErrorMessage(logger, error.fullMessage, options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show an error message and log it to the console
|
||||
*
|
||||
@@ -1,6 +1,10 @@
|
||||
import { commands, Disposable } from "vscode";
|
||||
import { CommandFunction, CommandManager } from "../../packages/commands";
|
||||
import { extLogger, OutputChannelLogger } from "../logging";
|
||||
import {
|
||||
extLogger,
|
||||
OutputChannelLogger,
|
||||
showAndLogWarningMessage,
|
||||
} from "../logging";
|
||||
import {
|
||||
asError,
|
||||
getErrorMessage,
|
||||
@@ -9,10 +13,7 @@ import {
|
||||
import { redactableError } from "../../pure/errors";
|
||||
import { UserCancellationException } from "./progress";
|
||||
import { telemetryListener } from "../../telemetry";
|
||||
import {
|
||||
showAndLogExceptionWithTelemetry,
|
||||
showAndLogWarningMessage,
|
||||
} from "./log";
|
||||
import { showAndLogExceptionWithTelemetry } from "./logging";
|
||||
|
||||
/**
|
||||
* Create a command manager for VSCode, wrapping registerCommandWithErrorHandling
|
||||
|
||||
@@ -7,8 +7,8 @@ import {
|
||||
getErrorMessage,
|
||||
getErrorStack,
|
||||
} from "../../pure/helpers-pure";
|
||||
import { showAndLogExceptionWithTelemetry } from "./log";
|
||||
import { extLogger } from "../logging";
|
||||
import { showAndLogExceptionWithTelemetry } from "./logging";
|
||||
|
||||
export async function tryOpenExternalFile(
|
||||
commandManager: AppCommandManager,
|
||||
|
||||
30
extensions/ql-vscode/src/common/vscode/logging.ts
Normal file
30
extensions/ql-vscode/src/common/vscode/logging.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import {
|
||||
NotificationLogger,
|
||||
showAndLogErrorMessage,
|
||||
ShowAndLogOptions,
|
||||
} from "../logging";
|
||||
import { RedactableError } from "../../pure/errors";
|
||||
import { telemetryListener } from "../../telemetry";
|
||||
|
||||
interface ShowAndLogExceptionOptions extends ShowAndLogOptions {
|
||||
/** Custom properties to include in the telemetry report. */
|
||||
extraTelemetryProperties?: { [key: string]: string };
|
||||
}
|
||||
|
||||
/**
|
||||
* Show an error message, log it to the console, and emit redacted information as telemetry
|
||||
*
|
||||
* @param logger The logger that will receive the message.
|
||||
* @param error The error to show. Only redacted information will be included in the telemetry.
|
||||
* @param options See individual fields on `ShowAndLogExceptionOptions` type.
|
||||
*
|
||||
* @return A promise that resolves to the selected item or undefined when being dismissed.
|
||||
*/
|
||||
export async function showAndLogExceptionWithTelemetry(
|
||||
logger: NotificationLogger,
|
||||
error: RedactableError,
|
||||
options: ShowAndLogExceptionOptions = {},
|
||||
): Promise<void> {
|
||||
telemetryListener?.sendError(error, options.extraTelemetryProperties);
|
||||
return showAndLogErrorMessage(logger, error.fullMessage, options);
|
||||
}
|
||||
@@ -3,8 +3,7 @@ import {
|
||||
TreeViewContextMultiSelectionCommandFunction,
|
||||
TreeViewContextSingleSelectionCommandFunction,
|
||||
} from "../commands";
|
||||
import { showAndLogErrorMessage } from "./log";
|
||||
import { extLogger } from "../logging";
|
||||
import { showAndLogErrorMessage, extLogger } from "../logging";
|
||||
|
||||
// A hack to match types that are not an array, which is useful to help avoid
|
||||
// misusing createSingleSelectionCommand, e.g. where T accidentally gets instantiated
|
||||
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
QueryCompareResult,
|
||||
} from "../pure/interface-types";
|
||||
import { extLogger, Logger } from "../common";
|
||||
import { showAndLogExceptionWithTelemetry } from "../common/vscode/logging";
|
||||
import { CodeQLCliServer } from "../codeql-cli/cli";
|
||||
import { DatabaseManager } from "../databases/local-databases";
|
||||
import { jumpToLocation } from "../databases/local-databases/locations";
|
||||
@@ -25,8 +26,6 @@ import {
|
||||
import { telemetryListener } from "../telemetry";
|
||||
import { redactableError } from "../pure/errors";
|
||||
|
||||
import { showAndLogExceptionWithTelemetry } from "../common/vscode/log";
|
||||
|
||||
interface ComparePair {
|
||||
from: CompletedLocalQueryInfo;
|
||||
to: CompletedLocalQueryInfo;
|
||||
|
||||
@@ -9,7 +9,7 @@ import { join } from "path";
|
||||
import { App } from "../common/app";
|
||||
import { withProgress } from "../common/vscode/progress";
|
||||
import { pickExtensionPackModelFile } from "./extension-pack-picker";
|
||||
import { showAndLogErrorMessage } from "../common/vscode/log";
|
||||
import { showAndLogErrorMessage } from "../common/logging";
|
||||
import { extLogger } from "../common";
|
||||
|
||||
const SUPPORTED_LANGUAGES: string[] = ["java", "csharp"];
|
||||
|
||||
@@ -18,6 +18,7 @@ import {
|
||||
import { ProgressUpdate } from "../common/vscode/progress";
|
||||
import { QueryRunner } from "../query-server";
|
||||
import { extLogger } from "../common";
|
||||
import { showAndLogExceptionWithTelemetry } from "../common/vscode/logging";
|
||||
import { outputFile, pathExists, readFile } from "fs-extra";
|
||||
import { load as loadYaml } from "js-yaml";
|
||||
import { DatabaseItem, DatabaseManager } from "../databases/local-databases";
|
||||
@@ -42,10 +43,7 @@ import {
|
||||
} from "./auto-model";
|
||||
import { showLlmGeneration } from "../config";
|
||||
import { getAutoModelUsages } from "./auto-model-usages-query";
|
||||
import {
|
||||
showAndLogErrorMessage,
|
||||
showAndLogExceptionWithTelemetry,
|
||||
} from "../common/vscode/log";
|
||||
import { showAndLogErrorMessage } from "../common/logging";
|
||||
|
||||
export class DataExtensionsEditorView extends AbstractWebview<
|
||||
ToDataExtensionsEditorMessage,
|
||||
|
||||
@@ -13,9 +13,8 @@ import { DatabaseItem } from "../databases/local-databases";
|
||||
import { getQlPackPath, QLPACK_FILENAMES } from "../pure/ql";
|
||||
import { getErrorMessage } from "../pure/helpers-pure";
|
||||
import { ExtensionPack, ExtensionPackModelFile } from "./shared/extension-pack";
|
||||
import { showAndLogErrorMessage } from "../common/vscode/log";
|
||||
import { showAndLogErrorMessage, extLogger } from "../common/logging";
|
||||
import { containsPath } from "../pure/files";
|
||||
import { extLogger } from "../common";
|
||||
|
||||
const maxStep = 3;
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import { writeFile } from "fs-extra";
|
||||
import { dump as dumpYaml } from "js-yaml";
|
||||
import { getOnDiskWorkspaceFolders } from "../common/vscode/workspace-folders";
|
||||
import { extLogger, TeeLogger } from "../common";
|
||||
import { showAndLogExceptionWithTelemetry } from "../common/vscode/logging";
|
||||
import { isQueryLanguage } from "../common/query-language";
|
||||
import { CancellationToken } from "vscode";
|
||||
import { CodeQLCliServer } from "../codeql-cli/cli";
|
||||
@@ -13,7 +14,6 @@ import { fetchExternalApiQueries } from "./queries";
|
||||
import { QueryResultType } from "../pure/new-messages";
|
||||
import { join } from "path";
|
||||
import { redactableError } from "../pure/errors";
|
||||
import { showAndLogExceptionWithTelemetry } from "../common/vscode/log";
|
||||
|
||||
export type RunQueryOptions = {
|
||||
cliServer: Pick<CodeQLCliServer, "resolveQlpacks">;
|
||||
|
||||
@@ -4,6 +4,7 @@ import { basename } from "path";
|
||||
import { QueryRunner } from "../query-server";
|
||||
import { CodeQLCliServer } from "../codeql-cli/cli";
|
||||
import { extLogger, TeeLogger } from "../common";
|
||||
import { showAndLogExceptionWithTelemetry } from "../common/vscode/logging";
|
||||
import { extensiblePredicateDefinitions } from "./predicates";
|
||||
import { ProgressCallback } from "../common/vscode/progress";
|
||||
import { getOnDiskWorkspaceFolders } from "../common/vscode/workspace-folders";
|
||||
@@ -17,7 +18,6 @@ import { file } from "tmp-promise";
|
||||
import { writeFile } from "fs-extra";
|
||||
import { dump } from "js-yaml";
|
||||
import { qlpackOfDatabase } from "../language-support";
|
||||
import { showAndLogExceptionWithTelemetry } from "../common/vscode/log";
|
||||
|
||||
type FlowModelOptions = {
|
||||
cliServer: CodeQLCliServer;
|
||||
|
||||
@@ -3,7 +3,7 @@ import { throttling } from "@octokit/plugin-throttling";
|
||||
import { Octokit } from "@octokit/rest";
|
||||
import { Progress, CancellationToken } from "vscode";
|
||||
import { Credentials } from "../common/authentication";
|
||||
import { showAndLogWarningMessage } from "../common/vscode/log";
|
||||
import { showAndLogWarningMessage } from "../common/logging";
|
||||
import { extLogger } from "../common";
|
||||
|
||||
export async function getCodeSearchRepositories(
|
||||
|
||||
@@ -31,7 +31,7 @@ import {
|
||||
import { Credentials } from "../common/authentication";
|
||||
import { AppCommandManager } from "../common/commands";
|
||||
import { ALLOW_HTTP_SETTING } from "../config";
|
||||
import { showAndLogInformationMessage } from "../common/vscode/log";
|
||||
import { showAndLogInformationMessage } from "../common/logging";
|
||||
|
||||
/**
|
||||
* Prompts a user to fetch a database from a remote location. Database is assumed to be an archive file.
|
||||
|
||||
@@ -33,6 +33,7 @@ import {
|
||||
isLikelyDbLanguageFolder,
|
||||
} from "./local-databases/db-contents-heuristics";
|
||||
import { extLogger } from "../common";
|
||||
import { showAndLogExceptionWithTelemetry } from "../common/vscode/logging";
|
||||
import {
|
||||
importArchiveDatabase,
|
||||
promptImportGithubDatabase,
|
||||
@@ -48,10 +49,7 @@ import {
|
||||
createMultiSelectionCommand,
|
||||
createSingleSelectionCommand,
|
||||
} from "../common/vscode/selection-commands";
|
||||
import {
|
||||
showAndLogErrorMessage,
|
||||
showAndLogExceptionWithTelemetry,
|
||||
} from "../common/vscode/log";
|
||||
import { showAndLogErrorMessage } from "../common/logging";
|
||||
|
||||
enum SortOrder {
|
||||
NameAsc = "NameAsc",
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import vscode, { ExtensionContext } from "vscode";
|
||||
import { extLogger, Logger } from "../../common";
|
||||
import { showAndLogExceptionWithTelemetry } from "../../common/vscode/logging";
|
||||
import { DisposableObject } from "../../pure/disposable-object";
|
||||
import { App } from "../../common/app";
|
||||
import { QueryRunner } from "../../query-server";
|
||||
@@ -28,7 +29,6 @@ import { remove } from "fs-extra";
|
||||
import { containsPath } from "../../pure/files";
|
||||
import { DatabaseChangedEvent, DatabaseEventKind } from "./database-events";
|
||||
import { DatabaseResolver } from "./database-resolver";
|
||||
import { showAndLogExceptionWithTelemetry } from "../../common/vscode/log";
|
||||
|
||||
/**
|
||||
* The name of the key in the workspaceState dictionary in which we
|
||||
|
||||
@@ -11,7 +11,7 @@ import { encodeArchiveBasePath } from "../../common/vscode/archive-filesystem-pr
|
||||
import {
|
||||
showAndLogInformationMessage,
|
||||
showAndLogWarningMessage,
|
||||
} from "../../common/vscode/log";
|
||||
} from "../../common/logging";
|
||||
import { extLogger } from "../../common";
|
||||
|
||||
export class DatabaseResolver {
|
||||
|
||||
@@ -37,7 +37,7 @@ import { getCodeSearchRepositories } from "../code-search-api";
|
||||
import {
|
||||
showAndLogErrorMessage,
|
||||
showAndLogInformationMessage,
|
||||
} from "../../common/vscode/log";
|
||||
} from "../../common/logging";
|
||||
import { extLogger } from "../../common";
|
||||
|
||||
export interface RemoteDatabaseQuickPickItem extends QuickPickItem {
|
||||
|
||||
@@ -9,7 +9,7 @@ import { LocalQueries } from "../local-queries";
|
||||
import { getQuickEvalContext, validateQueryPath } from "../run-queries-shared";
|
||||
import * as CodeQLProtocol from "./debug-protocol";
|
||||
import { getErrorMessage } from "../pure/helpers-pure";
|
||||
import { showAndLogErrorMessage } from "../common/vscode/log";
|
||||
import { showAndLogErrorMessage } from "../common/logging";
|
||||
import { extLogger } from "../common";
|
||||
|
||||
/**
|
||||
|
||||
@@ -80,6 +80,7 @@ import {
|
||||
ProgressReporter,
|
||||
queryServerLogger,
|
||||
} from "./common";
|
||||
import { showAndLogExceptionWithTelemetry } from "./common/vscode/logging";
|
||||
import { QueryHistoryManager } from "./query-history/query-history-manager";
|
||||
import { CompletedLocalQueryInfo } from "./query-results";
|
||||
import {
|
||||
@@ -127,10 +128,9 @@ import { NewQueryRunner, QueryRunner, QueryServerClient } from "./query-server";
|
||||
import { QueriesModule } from "./queries-panel/queries-module";
|
||||
import {
|
||||
showAndLogErrorMessage,
|
||||
showAndLogExceptionWithTelemetry,
|
||||
showAndLogInformationMessage,
|
||||
showAndLogWarningMessage,
|
||||
} from "./common/vscode/log";
|
||||
} from "./common/logging";
|
||||
|
||||
/**
|
||||
* extension.ts
|
||||
|
||||
@@ -27,8 +27,8 @@ import { DisposableObject } from "../../pure/disposable-object";
|
||||
import { asError, getErrorMessage } from "../../pure/helpers-pure";
|
||||
import { redactableError } from "../../pure/errors";
|
||||
import { AstViewerCommands } from "../../common/commands";
|
||||
import { showAndLogExceptionWithTelemetry } from "../../common/vscode/log";
|
||||
import { extLogger } from "../../common";
|
||||
import { showAndLogExceptionWithTelemetry } from "../../common/vscode/logging";
|
||||
|
||||
export interface AstItem {
|
||||
id: BqrsId;
|
||||
|
||||
@@ -18,12 +18,12 @@ import {
|
||||
import { CodeQLCliServer } from "../../codeql-cli/cli";
|
||||
import { DatabaseItem } from "../../databases/local-databases";
|
||||
import { extLogger, TeeLogger } from "../../common";
|
||||
import { showAndLogExceptionWithTelemetry } from "../../common/vscode/logging";
|
||||
import { CancellationToken } from "vscode";
|
||||
import { ProgressCallback } from "../../common/vscode/progress";
|
||||
import { CoreCompletedQuery, QueryRunner } from "../../query-server";
|
||||
import { redactableError } from "../../pure/errors";
|
||||
import { QLPACK_FILENAMES } from "../../pure/ql";
|
||||
import { showAndLogExceptionWithTelemetry } from "../../common/vscode/log";
|
||||
|
||||
export async function qlpackOfDatabase(
|
||||
cli: Pick<CodeQLCliServer, "resolveQlpacks">,
|
||||
|
||||
@@ -5,8 +5,8 @@ import { basename, join } from "path";
|
||||
import { getErrorMessage } from "../pure/helpers-pure";
|
||||
import { redactableError } from "../pure/errors";
|
||||
import { AppCommandManager, QueryEditorCommands } from "../common/commands";
|
||||
import { showAndLogExceptionWithTelemetry } from "../common/vscode/log";
|
||||
import { extLogger } from "../common";
|
||||
import { showAndLogExceptionWithTelemetry } from "../common/vscode/logging";
|
||||
|
||||
type QueryEditorOptions = {
|
||||
commandManager: AppCommandManager;
|
||||
|
||||
@@ -46,7 +46,7 @@ import { createMultiSelectionCommand } from "../common/vscode/selection-commands
|
||||
import {
|
||||
showAndLogErrorMessage,
|
||||
showAndLogWarningMessage,
|
||||
} from "../common/vscode/log";
|
||||
} from "../common/logging";
|
||||
import { findLanguage } from "../codeql-cli/query-language";
|
||||
|
||||
interface DatabaseQuickPickItem extends QuickPickItem {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { BaseLogger, extLogger, Logger } from "../common";
|
||||
import { showAndLogExceptionWithTelemetry } from "../common/vscode/logging";
|
||||
import { CoreQueryResults } from "../query-server";
|
||||
import { QueryHistoryManager } from "../query-history/query-history-manager";
|
||||
import { DatabaseItem } from "../databases/local-databases";
|
||||
@@ -16,10 +17,7 @@ import { CodeQLCliServer } from "../codeql-cli/cli";
|
||||
import { QueryResultType } from "../pure/new-messages";
|
||||
import { redactableError } from "../pure/errors";
|
||||
import { LocalQueries } from "./local-queries";
|
||||
import {
|
||||
showAndLogExceptionWithTelemetry,
|
||||
showAndLogWarningMessage,
|
||||
} from "../common/vscode/log";
|
||||
import { showAndLogWarningMessage } from "../common/logging";
|
||||
import { tryGetQueryMetadata } from "../codeql-cli/query-metadata";
|
||||
|
||||
function formatResultMessage(result: CoreQueryResults): string {
|
||||
|
||||
@@ -41,6 +41,7 @@ import {
|
||||
ParsedResultSets,
|
||||
} from "../pure/interface-types";
|
||||
import { extLogger, Logger } from "../common";
|
||||
import { showAndLogExceptionWithTelemetry } from "../common/vscode/logging";
|
||||
import {
|
||||
CompletedQueryInfo,
|
||||
interpretResultsSarif,
|
||||
@@ -73,7 +74,6 @@ import { HistoryItemLabelProvider } from "../query-history/history-item-label-pr
|
||||
import { telemetryListener } from "../telemetry";
|
||||
import { redactableError } from "../pure/errors";
|
||||
import { ResultsViewCommands } from "../common/commands";
|
||||
import { showAndLogExceptionWithTelemetry } from "../common/vscode/log";
|
||||
|
||||
/**
|
||||
* results-view.ts
|
||||
|
||||
@@ -7,14 +7,12 @@ import {
|
||||
withProgress,
|
||||
} from "../common/vscode/progress";
|
||||
import { extLogger } from "../common";
|
||||
import { showAndLogExceptionWithTelemetry } from "../common/vscode/logging";
|
||||
import { asError, getErrorStack } from "../pure/helpers-pure";
|
||||
import { redactableError } from "../pure/errors";
|
||||
import { PACKS_BY_QUERY_LANGUAGE } from "../common/query-language";
|
||||
import { PackagingCommands } from "../common/commands";
|
||||
import {
|
||||
showAndLogExceptionWithTelemetry,
|
||||
showAndLogInformationMessage,
|
||||
} from "../common/vscode/log";
|
||||
import { showAndLogInformationMessage } from "../common/logging";
|
||||
|
||||
type PackagingOptions = {
|
||||
cliServer: CodeQLCliServer;
|
||||
|
||||
@@ -12,8 +12,8 @@ import { DisposableObject } from "../pure/disposable-object";
|
||||
import { asError, getErrorMessage } from "../pure/helpers-pure";
|
||||
import { redactableError } from "../pure/errors";
|
||||
import { EvalLogViewerCommands } from "../common/commands";
|
||||
import { showAndLogExceptionWithTelemetry } from "../common/vscode/log";
|
||||
import { extLogger } from "../common";
|
||||
import { showAndLogExceptionWithTelemetry } from "../common/vscode/logging";
|
||||
|
||||
export interface EvalLogTreeItem {
|
||||
label?: string;
|
||||
|
||||
@@ -60,7 +60,7 @@ import {
|
||||
showAndLogErrorMessage,
|
||||
showAndLogInformationMessage,
|
||||
showAndLogWarningMessage,
|
||||
} from "../common/vscode/log";
|
||||
} from "../common/logging";
|
||||
|
||||
/**
|
||||
* query-history-manager.ts
|
||||
|
||||
@@ -12,8 +12,8 @@ import { redactableError } from "../../pure/errors";
|
||||
import { QueryHistoryDto, QueryHistoryItemDto } from "./query-history-dto";
|
||||
import { mapQueryHistoryToDomainModel } from "./query-history-dto-mapper";
|
||||
import { mapQueryHistoryToDto } from "./query-history-domain-mapper";
|
||||
import { showAndLogExceptionWithTelemetry } from "../../common/vscode/log";
|
||||
import { extLogger } from "../../common";
|
||||
import { showAndLogExceptionWithTelemetry } from "../../common/vscode/logging";
|
||||
|
||||
const ALLOWED_QUERY_HISTORY_VERSIONS = [1, 2];
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ import { tmpDir } from "../../tmp-dir";
|
||||
import { ProgressCallback } from "../../common/vscode/progress";
|
||||
import { QueryMetadata } from "../../pure/interface-types";
|
||||
import { extLogger, Logger } from "../../common";
|
||||
import { showAndLogExceptionWithTelemetry } from "../../common/vscode/logging";
|
||||
import * as messages from "../../pure/legacy-messages";
|
||||
import * as newMessages from "../../pure/new-messages";
|
||||
import * as qsClient from "./query-server-client";
|
||||
@@ -22,10 +23,7 @@ import { QueryEvaluationInfo, QueryOutputDir } from "../../run-queries-shared";
|
||||
import { redactableError } from "../../pure/errors";
|
||||
import { CoreQueryResults, CoreQueryTarget } from "../query-runner";
|
||||
import { Position } from "../../pure/messages-shared";
|
||||
import {
|
||||
showAndLogExceptionWithTelemetry,
|
||||
showAndLogWarningMessage,
|
||||
} from "../../common/vscode/log";
|
||||
import { showAndLogWarningMessage } from "../../common/logging";
|
||||
import { ensureDirSync } from "fs-extra";
|
||||
|
||||
const upgradesTmpDir = join(tmpDir.name, "upgrades");
|
||||
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
UserCancellationException,
|
||||
} from "../../common/vscode/progress";
|
||||
import { extLogger } from "../../common";
|
||||
import { showAndLogExceptionWithTelemetry } from "../../common/vscode/logging";
|
||||
import * as messages from "../../pure/legacy-messages";
|
||||
import * as qsClient from "./query-server-client";
|
||||
import * as tmp from "tmp-promise";
|
||||
@@ -13,7 +14,6 @@ import { dirname } from "path";
|
||||
import { DatabaseItem } from "../../databases/local-databases";
|
||||
import { asError, getErrorMessage } from "../../pure/helpers-pure";
|
||||
import { redactableError } from "../../pure/errors";
|
||||
import { showAndLogExceptionWithTelemetry } from "../../common/vscode/log";
|
||||
|
||||
/**
|
||||
* Maximum number of lines to include from database upgrade message,
|
||||
|
||||
@@ -19,7 +19,7 @@ import {
|
||||
import { ServerProcess } from "./server-process";
|
||||
import { App } from "../common/app";
|
||||
|
||||
import { showAndLogErrorMessage } from "../common/vscode/log";
|
||||
import { showAndLogErrorMessage } from "../common/logging";
|
||||
|
||||
type ServerOpts = {
|
||||
logger: Logger;
|
||||
|
||||
@@ -6,11 +6,9 @@ import { asError, getErrorMessage } from "../pure/helpers-pure";
|
||||
import { redactableError } from "../pure/errors";
|
||||
import { access } from "fs-extra";
|
||||
import { BaseLogger, extLogger } from "../common";
|
||||
import { showAndLogExceptionWithTelemetry } from "../common/vscode/logging";
|
||||
import { DisposableObject } from "../pure/disposable-object";
|
||||
import {
|
||||
showAndLogExceptionWithTelemetry,
|
||||
showAndLogWarningMessage,
|
||||
} from "../common/vscode/log";
|
||||
import { showAndLogWarningMessage } from "../common/logging";
|
||||
|
||||
async function isFileAccessible(uri: Uri): Promise<boolean> {
|
||||
try {
|
||||
|
||||
@@ -31,7 +31,7 @@ import { DecodedBqrsChunk, EntityValue } from "./pure/bqrs-cli-types";
|
||||
import { BaseLogger, extLogger } from "./common";
|
||||
import { generateSummarySymbolsFile } from "./log-insights/summary-parser";
|
||||
import { getErrorMessage } from "./pure/helpers-pure";
|
||||
import { showAndLogWarningMessage } from "./common/vscode/log";
|
||||
import { showAndLogWarningMessage } from "./common/logging";
|
||||
|
||||
/**
|
||||
* run-queries.ts
|
||||
|
||||
@@ -11,8 +11,8 @@ import {
|
||||
} from "../pure/interface-types";
|
||||
import { DataFlowPaths } from "./shared/data-flow-paths";
|
||||
import { redactableError } from "../pure/errors";
|
||||
import { showAndLogExceptionWithTelemetry } from "../common/vscode/log";
|
||||
import { extLogger } from "../common";
|
||||
import { showAndLogExceptionWithTelemetry } from "../common/vscode/logging";
|
||||
|
||||
export class DataFlowPathsView extends AbstractWebview<
|
||||
ToDataFlowPathsMessage,
|
||||
|
||||
@@ -2,7 +2,7 @@ import { TextDocumentContentProvider, Uri } from "vscode";
|
||||
import { URLSearchParams } from "url";
|
||||
import { SHOW_QUERY_TEXT_MSG } from "../query-history/query-history-manager";
|
||||
import { VariantAnalysisManager } from "./variant-analysis-manager";
|
||||
import { showAndLogWarningMessage } from "../common/vscode/log";
|
||||
import { showAndLogWarningMessage } from "../common/logging";
|
||||
import { extLogger } from "../common";
|
||||
|
||||
export const createVariantAnalysisContentProvider = (
|
||||
|
||||
@@ -72,11 +72,11 @@ import {
|
||||
import { GITHUB_AUTH_PROVIDER_ID } from "../common/vscode/authentication";
|
||||
import { FetchError } from "node-fetch";
|
||||
import { extLogger } from "../common";
|
||||
import { showAndLogExceptionWithTelemetry } from "../common/vscode/logging";
|
||||
import {
|
||||
showAndLogExceptionWithTelemetry,
|
||||
showAndLogInformationMessage,
|
||||
showAndLogWarningMessage,
|
||||
} from "../common/vscode/log";
|
||||
} from "../common/logging";
|
||||
|
||||
const maxRetryCount = 3;
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ import { sleep } from "../pure/time";
|
||||
import { getErrorMessage } from "../pure/helpers-pure";
|
||||
import { App } from "../common/app";
|
||||
import { extLogger } from "../common";
|
||||
import { showAndLogWarningMessage } from "../common/vscode/log";
|
||||
import { showAndLogWarningMessage } from "../common/logging";
|
||||
|
||||
export class VariantAnalysisMonitor extends DisposableObject {
|
||||
// With a sleep of 5 seconds, the maximum number of attempts takes
|
||||
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
WebviewPanelConfig,
|
||||
} from "../common/vscode/abstract-webview";
|
||||
import { extLogger } from "../common";
|
||||
import { showAndLogExceptionWithTelemetry } from "../common/vscode/logging";
|
||||
import {
|
||||
FromVariantAnalysisMessage,
|
||||
ToVariantAnalysisMessage,
|
||||
@@ -27,10 +28,7 @@ import {
|
||||
getVariantAnalysisDefaultResultsFilter,
|
||||
getVariantAnalysisDefaultResultsSort,
|
||||
} from "../config";
|
||||
import {
|
||||
showAndLogExceptionWithTelemetry,
|
||||
showAndLogWarningMessage,
|
||||
} from "../common/vscode/log";
|
||||
import { showAndLogWarningMessage } from "../common/logging";
|
||||
|
||||
export class VariantAnalysisView
|
||||
extends AbstractWebview<ToVariantAnalysisMessage, FromVariantAnalysisMessage>
|
||||
|
||||
@@ -23,8 +23,8 @@ import {
|
||||
import { createMockVariantAnalysis } from "../../../factories/variant-analysis/shared/variant-analysis";
|
||||
import { createMockApp } from "../../../__mocks__/appMock";
|
||||
import { createMockCommandManager } from "../../../__mocks__/commandsMock";
|
||||
import * as log from "../../../../src/common/vscode/log";
|
||||
import { showAndLogWarningMessage } from "../../../../src/common/vscode/log";
|
||||
import * as log from "../../../../src/common/logging";
|
||||
import { showAndLogWarningMessage } from "../../../../src/common/logging";
|
||||
|
||||
jest.setTimeout(60_000);
|
||||
|
||||
|
||||
@@ -4,17 +4,16 @@ import { join } from "path";
|
||||
import { CodeQLCliServer } from "../../../../src/codeql-cli/cli";
|
||||
import { getErrorMessage } from "../../../../src/pure/helpers-pure";
|
||||
|
||||
import * as log from "../../../../src/common/vscode/log";
|
||||
import * as log from "../../../../src/common/logging";
|
||||
import * as vscodeLog from "../../../../src/common/vscode/logging";
|
||||
import {
|
||||
handleDownloadPacks,
|
||||
handleInstallPackDependencies,
|
||||
} from "../../../../src/packaging";
|
||||
import { mockedQuickPickItem } from "../../utils/mocking.helpers";
|
||||
import { getActivatedExtension } from "../../global.helper";
|
||||
import {
|
||||
showAndLogExceptionWithTelemetry,
|
||||
showAndLogInformationMessage,
|
||||
} from "../../../../src/common/vscode/log";
|
||||
import { showAndLogInformationMessage } from "../../../../src/common/logging";
|
||||
import { showAndLogExceptionWithTelemetry } from "../../../../src/common/vscode/logging";
|
||||
|
||||
describe("Packaging commands", () => {
|
||||
let cli: CodeQLCliServer;
|
||||
@@ -36,7 +35,7 @@ describe("Packaging commands", () => {
|
||||
.spyOn(window, "showInputBox")
|
||||
.mockResolvedValue(undefined);
|
||||
showAndLogExceptionWithTelemetrySpy = jest
|
||||
.spyOn(log, "showAndLogExceptionWithTelemetry")
|
||||
.spyOn(vscodeLog, "showAndLogExceptionWithTelemetry")
|
||||
.mockResolvedValue(undefined);
|
||||
showAndLogInformationMessageSpy = jest
|
||||
.spyOn(log, "showAndLogInformationMessage")
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as fetch from "node-fetch";
|
||||
import { Range } from "semver";
|
||||
|
||||
import * as log from "../../../../src/common/vscode/log";
|
||||
import * as log from "../../../../src/common/logging";
|
||||
import { extLogger } from "../../../../src/common";
|
||||
import * as fs from "fs-extra";
|
||||
import * as path from "path";
|
||||
@@ -18,7 +18,7 @@ import {
|
||||
import {
|
||||
showAndLogErrorMessage,
|
||||
showAndLogWarningMessage,
|
||||
} from "../../../../src/common/vscode/log";
|
||||
} from "../../../../src/common/logging";
|
||||
|
||||
jest.mock("os", () => {
|
||||
const original = jest.requireActual("os");
|
||||
|
||||
@@ -7,11 +7,11 @@ import {
|
||||
QlpacksInfo,
|
||||
ResolveExtensionsResult,
|
||||
} from "../../../../src/codeql-cli/cli";
|
||||
import * as log from "../../../../src/common/vscode/log";
|
||||
import * as log from "../../../../src/common/logging";
|
||||
|
||||
import { pickExtensionPackModelFile } from "../../../../src/data-extensions-editor/extension-pack-picker";
|
||||
import { ExtensionPack } from "../../../../src/data-extensions-editor/shared/extension-pack";
|
||||
import { showAndLogErrorMessage } from "../../../../src/common/vscode/log";
|
||||
import { showAndLogErrorMessage } from "../../../../src/common/logging";
|
||||
|
||||
describe("pickExtensionPackModelFile", () => {
|
||||
let tmpDir: string;
|
||||
|
||||
@@ -11,9 +11,9 @@ import { readdir, readFile } from "fs-extra";
|
||||
import { load } from "js-yaml";
|
||||
import { dirname, join } from "path";
|
||||
import { fetchExternalApiQueries } from "../../../../src/data-extensions-editor/queries";
|
||||
import * as log from "../../../../src/common/vscode/log";
|
||||
import * as vscodeLog from "../../../../src/common/vscode/logging";
|
||||
import { RedactableError } from "../../../../src/pure/errors";
|
||||
import { showAndLogExceptionWithTelemetry } from "../../../../src/common/vscode/log";
|
||||
import { showAndLogExceptionWithTelemetry } from "../../../../src/common/vscode/logging";
|
||||
|
||||
function createMockUri(path = "/a/b/c/foo"): Uri {
|
||||
return {
|
||||
@@ -140,7 +140,7 @@ describe("readQueryResults", () => {
|
||||
|
||||
beforeEach(() => {
|
||||
showAndLogExceptionWithTelemetrySpy = jest.spyOn(
|
||||
log,
|
||||
vscodeLog,
|
||||
"showAndLogExceptionWithTelemetry",
|
||||
);
|
||||
});
|
||||
|
||||
@@ -3,7 +3,7 @@ import * as fs from "fs-extra";
|
||||
|
||||
import { getErrorMessage } from "../../../../../src/pure/helpers-pure";
|
||||
|
||||
import * as log from "../../../../../src/common/vscode/log";
|
||||
import * as log from "../../../../../src/common/logging";
|
||||
import * as workspaceFolders from "../../../../../src/common/vscode/workspace-folders";
|
||||
import * as qlpack from "../../../../../src/databases/qlpack";
|
||||
import {
|
||||
|
||||
Reference in New Issue
Block a user