Просмотр исходного кода

Adds enable/disable debug logging commands

main
Eric Amodio 3 лет назад
Родитель
Сommit
9594bfcd20
9 измененных файлов: 82 добавлений и 1 удалений
  1. +2
    -0
      CHANGELOG.md
  2. +3
    -0
      README.md
  3. +23
    -0
      package.json
  4. +1
    -0
      src/commands.ts
  5. +2
    -0
      src/commands/common.ts
  6. +25
    -0
      src/commands/logging.ts
  7. +1
    -0
      src/config.ts
  8. +11
    -1
      src/extension.ts
  9. +14
    -0
      src/messages.ts

+ 2
- 0
CHANGELOG.md Просмотреть файл

@ -13,6 +13,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- Adds Gitea remote provider support — closes [#1379](https://github.com/eamodio/vscode-gitlens/issues/1379) thanks to [PR #1396](https://github.com/eamodio/vscode-gitlens/pull/1396) by Nils K ([septatrix](https://github.com/septatrix))
- Adds a `gitlens.advanced.commitOrdering` setting to specify the order by which commits will be shown. If unspecified, commits will be shown in reverse chronological order — closes [#1257](https://github.com/eamodio/vscode-gitlens/issues/1257) thanks to [PR #1344](https://github.com/eamodio/vscode-gitlens/pull/1344) by Andy Tang ([thewindsofwinter](https://github.com/thewindsofwinter)) and Shashank Shastri ([Shashank-Shastri](https://github.com/Shashank-Shastri))
- Adds [documentation](https://github.com/eamodio/vscode-gitlens#side-bar-views-) for the _GitLens: Set Views Layout_ command — thanks to [PR #1404](https://github.com/eamodio/vscode-gitlens/pull/1404) by Asif Kamran Malick ([@akmalick](https://github.com/akmalick))
- Adds an _Enable Debug Logging_ command (`gitlens.enableDebugLogging`) to enable debug logging to the GitLens output channel
- Adds a _Disable Debug Logging_ command (`gitlens.disableDebugLogging`) to disable debug logging to the GitLens output channel
### Fixed

+ 3
- 0
README.md Просмотреть файл

@ -641,6 +641,9 @@ Additionally, these integrations provide commands to copy the url of or open, fi
- Adds a _Open Changed Files_ command (`gitlens.openChangedFiles`) to open any files with working tree changes
- Adds a _Close Unchanged Files_ command (`gitlens.closeUnchangedFiles`) to close any files without working tree changes
- Adds an _Enable Debug Logging_ command (`gitlens.enableDebugLogging`) to enable debug logging to the GitLens output channel
- Adds a _Disable Debug Logging_ command (`gitlens.disableDebugLogging`) to disable debug logging to the GitLens output channel
## Menus & Toolbars [#](#menus- 'Menus & Toolbars')
<p align="center">

+ 23
- 0
package.json Просмотреть файл

@ -2590,6 +2590,7 @@
"suppressCommitHasNoPreviousCommitWarning": false,
"suppressCommitNotFoundWarning": false,
"suppressCreatePullRequestPrompt": false,
"suppressDebugLoggingWarning": false,
"suppressFileNotUnderSourceControlWarning": false,
"suppressGitDisabledWarning": false,
"suppressGitMissingWarning": false,
@ -2612,6 +2613,10 @@
"type": "boolean",
"default": false
},
"suppressDebugLoggingWarning": {
"type": "boolean",
"default": false
},
"suppressFileNotUnderSourceControlWarning": {
"type": "boolean",
"default": false
@ -5113,6 +5118,16 @@
"command": "gitlens.views.tags.setShowAvatarsOff",
"title": "Hide Avatars",
"category": "GitLens"
},
{
"command": "gitlens.enableDebugLogging",
"title": "Enable Debug Logging",
"category": "GitLens"
},
{
"command": "gitlens.disableDebugLogging",
"title": "Disable Debug Logging",
"category": "GitLens"
}
],
"menus": {
@ -6480,6 +6495,14 @@
{
"command": "gitlens.views.tags.setShowAvatarsOff",
"when": "false"
},
{
"command": "gitlens.enableDebugLogging",
"when": "config.gitlens.outputLevel != debug"
},
{
"command": "gitlens.disableDebugLogging",
"when": "config.gitlens.outputLevel != errors"
}
],
"editor/context": [

+ 1
- 0
src/commands.ts Просмотреть файл

@ -27,6 +27,7 @@ export * from './commands/diffWithWorking';
export * from './commands/externalDiff';
export * from './commands/gitCommands';
export * from './commands/inviteToLiveShare';
export * from './commands/logging';
export * from './commands/openAssociatedPullRequestOnRemote';
export * from './commands/openBranchesOnRemote';
export * from './commands/openBranchOnRemote';

+ 2
- 0
src/commands/common.ts Просмотреть файл

@ -70,6 +70,8 @@ export enum Commands {
DiffWithWorkingInDiffRight = 'gitlens.diffWithWorkingInDiffRight',
DiffLineWithWorking = 'gitlens.diffLineWithWorking',
DisconnectRemoteProvider = 'gitlens.disconnectRemoteProvider',
DisableDebugLogging = 'gitlens.disableDebugLogging',
EnableDebugLogging = 'gitlens.enableDebugLogging',
DisableRebaseEditor = 'gitlens.disableRebaseEditor',
EnableRebaseEditor = 'gitlens.enableRebaseEditor',
ExternalDiff = 'gitlens.externalDiff',

+ 25
- 0
src/commands/logging.ts Просмотреть файл

@ -0,0 +1,25 @@
'use strict';
import { command, Command, Commands } from './common';
import { configuration, TraceLevel } from '../configuration';
@command()
export class EnableDebugLoggingCommand extends Command {
constructor() {
super(Commands.EnableDebugLogging);
}
async execute() {
await configuration.updateEffective('outputLevel', TraceLevel.Debug);
}
}
@command()
export class DisableDebugLoggingCommand extends Command {
constructor() {
super(Commands.DisableDebugLogging);
}
async execute() {
await configuration.updateEffective('outputLevel', TraceLevel.Errors);
}
}

+ 1
- 0
src/config.ts Просмотреть файл

@ -320,6 +320,7 @@ export interface AdvancedConfig {
suppressCommitHasNoPreviousCommitWarning: boolean;
suppressCommitNotFoundWarning: boolean;
suppressCreatePullRequestPrompt: boolean;
suppressDebugLoggingWarning: boolean;
suppressFileNotUnderSourceControlWarning: boolean;
suppressGitDisabledWarning: boolean;
suppressGitMissingWarning: boolean;

+ 11
- 1
src/extension.ts Просмотреть файл

@ -5,7 +5,7 @@ import { CreatePullRequestActionContext, GitLensApi, OpenPullRequestActionContex
import { Api } from './api/api';
import { Commands, executeCommand, OpenPullRequestOnRemoteCommandArgs, registerCommands } from './commands';
import { CreatePullRequestOnRemoteCommandArgs } from './commands/createPullRequestOnRemote';
import { configuration, Configuration } from './configuration';
import { configuration, Configuration, TraceLevel } from './configuration';
import { ContextKeys, GlobalState, GlyphChars, setContext, SyncedState } from './constants';
import { Container } from './container';
import { Git, GitBranch, GitCommit } from './git/git';
@ -158,6 +158,16 @@ export async function activate(context: ExtensionContext): Promise
void context.globalState.update(SyncedState.Version, gitlensVersion);
}
if (cfg.outputLevel === TraceLevel.Debug) {
setTimeout(async () => {
if (cfg.outputLevel !== TraceLevel.Debug) return;
if (await Messages.showDebugLoggingWarningMessage()) {
void commands.executeCommand(Commands.DisableDebugLogging);
}
}, 60000);
}
Logger.log(
`GitLens (v${gitlensVersion}${cfg.mode.active ? `, mode: ${cfg.mode.active}` : ''}) activated ${
GlyphChars.Dot

+ 14
- 0
src/messages.ts Просмотреть файл

@ -8,6 +8,7 @@ export enum SuppressedMessages {
CommitHasNoPreviousCommitWarning = 'suppressCommitHasNoPreviousCommitWarning',
CommitNotFoundWarning = 'suppressCommitNotFoundWarning',
CreatePullRequestPrompt = 'suppressCreatePullRequestPrompt',
SuppressDebugLoggingWarning = 'suppressDebugLoggingWarning',
FileNotUnderSourceControlWarning = 'suppressFileNotUnderSourceControlWarning',
GitDisabledWarning = 'suppressGitDisabledWarning',
GitMissingWarning = 'suppressGitMissingWarning',
@ -54,6 +55,19 @@ export class Messages {
return result === create;
}
static async showDebugLoggingWarningMessage(): Promise<boolean> {
const disable = { title: 'Disable Debug Logging' };
const result = await Messages.showMessage(
'warn',
'GitLens debug logging is currently enabled. Unless you are reporting an issue, it is recommended to be disabled. Would you like to disable it?',
SuppressedMessages.SuppressDebugLoggingWarning,
{ title: "Don't Show Again" },
disable,
);
return result === disable;
}
static async showGenericErrorMessage(message: string): Promise<MessageItem | undefined> {
const actions: MessageItem[] = [{ title: 'Open Output Channel' }];
const result = await Messages.showMessage(

Загрузка…
Отмена
Сохранить