Browse Source

Uses new ExtensionMode

main
Eric Amodio 4 years ago
parent
commit
36988f095e
2 changed files with 7 additions and 27 deletions
  1. +0
    -12
      .vscode/launch.json
  2. +7
    -15
      src/logger.ts

+ 0
- 12
.vscode/launch.json View File

@ -10,9 +10,6 @@
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
"cwd": "${workspaceFolder}",
"debugWebviews": { "urlFilter": "*eamodio.gitlens*" },
"env": {
"VSCODE_DEBUGGING_EXTENSION": "gitlens"
},
"outFiles": ["${workspaceFolder}/dist/**/*.js"],
"presentation": {
"group": "2_run",
@ -31,9 +28,6 @@
"args": ["--disable-extensions", "--extensionDevelopmentPath=${workspaceFolder}"],
"cwd": "${workspaceFolder}",
"debugWebviews": { "urlFilter": "*eamodio.gitlens*" },
"env": {
"VSCODE_DEBUGGING_EXTENSION": "gitlens"
},
"outFiles": ["${workspaceFolder}/dist/**/*.js"],
"presentation": {
"group": "2_run",
@ -55,9 +49,6 @@
"urlFilter": "*eamodio.gitlens*",
"webRoot": "${workspaceFolder}/src/webviews/apps"
},
"env": {
"VSCODE_DEBUGGING_EXTENSION": "gitlens"
},
"outFiles": ["${workspaceFolder}/dist/**/*.js"],
"preLaunchTask": "${defaultBuildTask}",
"presentation": {
@ -77,9 +68,6 @@
"args": ["--disable-extensions", "--extensionDevelopmentPath=${workspaceFolder}"],
"cwd": "${workspaceFolder}",
"debugWebviews": { "urlFilter": "*eamodio.gitlens*" },
"env": {
"VSCODE_DEBUGGING_EXTENSION": "gitlens"
},
"outFiles": ["${workspaceFolder}/dist/**/*.js"],
"preLaunchTask": "npm: watch",
"presentation": {

+ 7
- 15
src/logger.ts View File

@ -1,5 +1,5 @@
'use strict';
import { ExtensionContext, OutputChannel, Uri, window } from 'vscode';
import { ExtensionContext, ExtensionMode, OutputChannel, Uri, window } from 'vscode';
import { extensionOutputChannelName } from './constants';
import { getCorrelationContext, getNextCorrelationId } from './system';
@ -14,8 +14,6 @@ export enum TraceLevel {
const ConsolePrefix = `[${extensionOutputChannelName}]`;
const isDebuggingRegex = /\bgitlens\b/i;
export interface LogCorrelationContext {
readonly correlationId?: number;
readonly prefix: string;
@ -29,9 +27,15 @@ export class Logger {
static configure(context: ExtensionContext, level: TraceLevel, loggableFn?: (o: any) => string | undefined) {
this.customLoggableFn = loggableFn;
this._isDebugging = context.extensionMode === ExtensionMode.Development;
this.level = level;
}
private static _isDebugging: boolean;
static get isDebugging() {
return this._isDebugging;
}
private static _level: TraceLevel = TraceLevel.Silent;
static get level() {
return this._level;
@ -253,18 +257,6 @@ export class Logger {
return loggableParams.length !== 0 ? ` \u2014 ${loggableParams}` : emptyStr;
}
private static _isDebugging: boolean | undefined;
static get isDebugging() {
if (this._isDebugging == null) {
const env = process.env;
this._isDebugging = env?.VSCODE_DEBUGGING_EXTENSION
? isDebuggingRegex.test(env.VSCODE_DEBUGGING_EXTENSION)
: false;
}
return this._isDebugging;
}
static gitOutput: OutputChannel | undefined;
static logGitCommand(command: string, ex?: Error): void {

Loading…
Cancel
Save