From e0b3dcd4841ffd25f014b3408fe9020d24e84862 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Mon, 27 Mar 2017 02:15:38 -0400 Subject: [PATCH] Refactors Logger.error to take the Error object --- src/commands/closeUnchangedFiles.ts | 2 +- src/commands/copyMessageToClipboard.ts | 4 ++-- src/commands/copyShaToClipboard.ts | 4 ++-- src/commands/diffDirectory.ts | 2 +- src/commands/diffLineWithPrevious.ts | 4 ++-- src/commands/diffLineWithWorking.ts | 2 +- src/commands/diffWithBranch.ts | 2 +- src/commands/diffWithNext.ts | 4 ++-- src/commands/diffWithPrevious.ts | 4 ++-- src/commands/diffWithWorking.ts | 4 ++-- src/commands/keyboard.ts | 2 +- src/commands/openChangedFiles.ts | 2 +- src/commands/openCommitInRemote.ts | 2 +- src/commands/openFileInRemote.ts | 2 +- src/commands/openInRemote.ts | 2 +- src/commands/showBlame.ts | 2 +- src/commands/showBlameHistory.ts | 2 +- src/commands/showFileHistory.ts | 2 +- src/commands/showLastQuickPick.ts | 2 +- src/commands/showQuickBranchHistory.ts | 2 +- src/commands/showQuickCommitDetails.ts | 4 ++-- src/commands/showQuickCommitFileDetails.ts | 4 ++-- src/commands/showQuickCurrentBranchHistory.ts | 2 +- src/commands/showQuickFileHistory.ts | 2 +- src/commands/showQuickRepoStatus.ts | 2 +- src/commands/toggleBlame.ts | 2 +- src/extension.ts | 2 +- src/git/git.ts | 2 +- src/git/remotes/factory.ts | 2 +- src/gitContentProvider.ts | 2 +- src/logger.ts | 6 +++--- 31 files changed, 41 insertions(+), 41 deletions(-) diff --git a/src/commands/closeUnchangedFiles.ts b/src/commands/closeUnchangedFiles.ts index a5a8d61..166cf36 100644 --- a/src/commands/closeUnchangedFiles.ts +++ b/src/commands/closeUnchangedFiles.ts @@ -63,7 +63,7 @@ export class CloseUnchangedFilesCommand extends ActiveEditorCommand { return undefined; } catch (ex) { - Logger.error('[GitLens.CloseUnchangedFilesCommand]', ex); + Logger.error(ex, 'CloseUnchangedFilesCommand'); return window.showErrorMessage(`Unable to close unchanged files. See output channel for more details`); } } diff --git a/src/commands/copyMessageToClipboard.ts b/src/commands/copyMessageToClipboard.ts index df97761..cfc20fb 100644 --- a/src/commands/copyMessageToClipboard.ts +++ b/src/commands/copyMessageToClipboard.ts @@ -50,7 +50,7 @@ export class CopyMessageToClipboardCommand extends ActiveEditorCommand { } } catch (ex) { - Logger.error('[GitLens.CopyMessageToClipboardCommand]', `getBlameForLine(${blameline})`, ex); + Logger.error(ex, 'CopyMessageToClipboardCommand', `getBlameForLine(${blameline})`); return window.showErrorMessage(`Unable to copy message. See output channel for more details`); } } @@ -66,7 +66,7 @@ export class CopyMessageToClipboardCommand extends ActiveEditorCommand { return undefined; } catch (ex) { - Logger.error('GitLens.CopyMessageToClipboardCommand', ex); + Logger.error(ex, 'CopyMessageToClipboardCommand'); return window.showErrorMessage(`Unable to copy message. See output channel for more details`); } } diff --git a/src/commands/copyShaToClipboard.ts b/src/commands/copyShaToClipboard.ts index 30f0566..d688198 100644 --- a/src/commands/copyShaToClipboard.ts +++ b/src/commands/copyShaToClipboard.ts @@ -44,7 +44,7 @@ export class CopyShaToClipboardCommand extends ActiveEditorCommand { sha = blame.commit.sha; } catch (ex) { - Logger.error('[GitLens.CopyShaToClipboardCommand]', `getBlameForLine(${blameline})`, ex); + Logger.error(ex, 'CopyShaToClipboardCommand', `getBlameForLine(${blameline})`); return window.showErrorMessage(`Unable to copy sha. See output channel for more details`); } } @@ -53,7 +53,7 @@ export class CopyShaToClipboardCommand extends ActiveEditorCommand { return undefined; } catch (ex) { - Logger.error('GitLens.CopyShaToClipboardCommand', ex); + Logger.error(ex, 'CopyShaToClipboardCommand'); return window.showErrorMessage(`Unable to copy sha. See output channel for more details`); } } diff --git a/src/commands/diffDirectory.ts b/src/commands/diffDirectory.ts index 499e4db..a7ef2f1 100644 --- a/src/commands/diffDirectory.ts +++ b/src/commands/diffDirectory.ts @@ -40,7 +40,7 @@ export class DiffDirectoryCommand extends ActiveEditorCommand { return undefined; } catch (ex) { - Logger.error('GitLens.DiffDirectoryCommand', ex); + Logger.error(ex, 'DiffDirectoryCommand'); return window.showErrorMessage(`Unable to open directory diff. See output channel for more details`); } } diff --git a/src/commands/diffLineWithPrevious.ts b/src/commands/diffLineWithPrevious.ts index 54e2236..c331d17 100644 --- a/src/commands/diffLineWithPrevious.ts +++ b/src/commands/diffLineWithPrevious.ts @@ -49,7 +49,7 @@ export class DiffLineWithPreviousCommand extends ActiveEditorCommand { } } catch (ex) { - Logger.error('[GitLens.DiffWithPreviousLineCommand]', `getBlameForLine(${blameline})`, ex); + Logger.error(ex, 'DiffWithPreviousLineCommand', `getBlameForLine(${blameline})`); return window.showErrorMessage(`Unable to open diff. See output channel for more details`); } } @@ -64,7 +64,7 @@ export class DiffLineWithPreviousCommand extends ActiveEditorCommand { return await commands.executeCommand(BuiltInCommands.RevealLine, { lineNumber: line, at: 'center' }); } catch (ex) { - Logger.error('[GitLens.DiffWithPreviousLineCommand]', 'getVersionedFile', ex); + Logger.error(ex, 'DiffWithPreviousLineCommand', 'getVersionedFile'); return window.showErrorMessage(`Unable to open diff. See output channel for more details`); } } diff --git a/src/commands/diffLineWithWorking.ts b/src/commands/diffLineWithWorking.ts index dda4b52..7a6fa86 100644 --- a/src/commands/diffLineWithWorking.ts +++ b/src/commands/diffLineWithWorking.ts @@ -39,7 +39,7 @@ export class DiffLineWithWorkingCommand extends ActiveEditorCommand { } } catch (ex) { - Logger.error('[GitLens.DiffLineWithWorkingCommand]', `getBlameForLine(${blameline})`, ex); + Logger.error(ex, 'DiffLineWithWorkingCommand', `getBlameForLine(${blameline})`); return window.showErrorMessage(`Unable to open diff. See output channel for more details`); } } diff --git a/src/commands/diffWithBranch.ts b/src/commands/diffWithBranch.ts index c994a42..7606933 100644 --- a/src/commands/diffWithBranch.ts +++ b/src/commands/diffWithBranch.ts @@ -40,7 +40,7 @@ export class DiffWithBranchCommand extends ActiveEditorCommand { return await commands.executeCommand(BuiltInCommands.RevealLine, { lineNumber: line, at: 'center' }); } catch (ex) { - Logger.error('[GitLens.DiffWithBranchCommand]', 'getVersionedFile', ex); + Logger.error(ex, 'DiffWithBranchCommand', 'getVersionedFile'); return window.showErrorMessage(`Unable to open diff. See output channel for more details`); } } diff --git a/src/commands/diffWithNext.ts b/src/commands/diffWithNext.ts index ab4c8fa..e4d4a8e 100644 --- a/src/commands/diffWithNext.ts +++ b/src/commands/diffWithNext.ts @@ -48,7 +48,7 @@ export class DiffWithNextCommand extends ActiveEditorCommand { commit = (sha && log.commits.get(sha)) || Iterables.first(log.commits.values()); } catch (ex) { - Logger.error('[GitLens.DiffWithNextCommand]', `getLogForFile(${gitUri.repoPath}, ${gitUri.fsPath})`, ex); + Logger.error(ex, 'DiffWithNextCommand', `getLogForFile(${gitUri.repoPath}, ${gitUri.fsPath})`); return window.showErrorMessage(`Unable to open diff. See output channel for more details`); } } @@ -66,7 +66,7 @@ export class DiffWithNextCommand extends ActiveEditorCommand { return await commands.executeCommand(BuiltInCommands.RevealLine, { lineNumber: line, at: 'center' }); } catch (ex) { - Logger.error('[GitLens.DiffWithNextCommand]', 'getVersionedFile', ex); + Logger.error(ex, 'DiffWithNextCommand', 'getVersionedFile'); return window.showErrorMessage(`Unable to open diff. See output channel for more details`); } } diff --git a/src/commands/diffWithPrevious.ts b/src/commands/diffWithPrevious.ts index a2b7667..108619e 100644 --- a/src/commands/diffWithPrevious.ts +++ b/src/commands/diffWithPrevious.ts @@ -49,7 +49,7 @@ export class DiffWithPreviousCommand extends ActiveEditorCommand { commit = (sha && log.commits.get(sha)) || Iterables.first(log.commits.values()); } catch (ex) { - Logger.error('[GitLens.DiffWithPreviousCommand]', `getLogForFile(${gitUri.repoPath}, ${gitUri.fsPath})`, ex); + Logger.error(ex, 'DiffWithPreviousCommand', `getLogForFile(${gitUri.repoPath}, ${gitUri.fsPath})`); return window.showErrorMessage(`Unable to open diff. See output channel for more details`); } } @@ -68,7 +68,7 @@ export class DiffWithPreviousCommand extends ActiveEditorCommand { return await commands.executeCommand(BuiltInCommands.RevealLine, { lineNumber: line, at: 'center' }); } catch (ex) { - Logger.error('[GitLens.DiffWithPreviousCommand]', 'getVersionedFile', ex); + Logger.error(ex, 'DiffWithPreviousCommand', 'getVersionedFile'); return window.showErrorMessage(`Unable to open diff. See output channel for more details`); } } diff --git a/src/commands/diffWithWorking.ts b/src/commands/diffWithWorking.ts index 4269343..68a3d9a 100644 --- a/src/commands/diffWithWorking.ts +++ b/src/commands/diffWithWorking.ts @@ -31,7 +31,7 @@ export class DiffWithWorkingCommand extends ActiveEditorCommand { if (!commit) return window.showWarningMessage(`Unable to open diff. File is probably not under source control`); } catch (ex) { - Logger.error('[GitLens.DiffWithWorkingCommand]', `getLogCommit(${gitUri.repoPath}, ${gitUri.fsPath}, ${gitUri.sha})`, ex); + Logger.error(ex, 'DiffWithWorkingCommand', `getLogCommit(${gitUri.repoPath}, ${gitUri.fsPath}, ${gitUri.sha})`); return window.showErrorMessage(`Unable to open diff. See output channel for more details`); } } @@ -46,7 +46,7 @@ export class DiffWithWorkingCommand extends ActiveEditorCommand { return await commands.executeCommand(BuiltInCommands.RevealLine, { lineNumber: line, at: 'center' }); } catch (ex) { - Logger.error('[GitLens.DiffWithWorkingCommand]', 'getVersionedFile', ex); + Logger.error(ex, 'DiffWithWorkingCommand', 'getVersionedFile'); return window.showErrorMessage(`Unable to open diff. See output channel for more details`); } } diff --git a/src/commands/keyboard.ts b/src/commands/keyboard.ts index 6d3bb31..961ed54 100644 --- a/src/commands/keyboard.ts +++ b/src/commands/keyboard.ts @@ -134,7 +134,7 @@ export class Keyboard extends Disposable { return await command.execute(); } catch (ex) { - Logger.error('Keyboard.execute', ex); + Logger.error(ex, 'Keyboard.execute'); return undefined; } } diff --git a/src/commands/openChangedFiles.ts b/src/commands/openChangedFiles.ts index 5ff23e9..bd43c11 100644 --- a/src/commands/openChangedFiles.ts +++ b/src/commands/openChangedFiles.ts @@ -34,7 +34,7 @@ export class OpenChangedFilesCommand extends ActiveEditorCommand { return undefined; } catch (ex) { - Logger.error('[GitLens.OpenChangedFilesCommand]', ex); + Logger.error(ex, 'OpenChangedFilesCommand'); return window.showErrorMessage(`Unable to open changed files. See output channel for more details`); } } diff --git a/src/commands/openCommitInRemote.ts b/src/commands/openCommitInRemote.ts index e42f87f..7ee9f22 100644 --- a/src/commands/openCommitInRemote.ts +++ b/src/commands/openCommitInRemote.ts @@ -39,7 +39,7 @@ export class OpenCommitInRemoteCommand extends ActiveEditorCommand { return commands.executeCommand(Commands.OpenInRemote, uri, remotes, 'commit', [commit.sha]); } catch (ex) { - Logger.error('[GitLens.OpenCommitInRemoteCommand]', ex); + Logger.error(ex, 'OpenCommitInRemoteCommand'); return window.showErrorMessage(`Unable to open commit in remote provider. See output channel for more details`); } } diff --git a/src/commands/openFileInRemote.ts b/src/commands/openFileInRemote.ts index b691e8e..5bf916a 100644 --- a/src/commands/openFileInRemote.ts +++ b/src/commands/openFileInRemote.ts @@ -25,7 +25,7 @@ export class OpenFileInRemoteCommand extends ActiveEditorCommand { return commands.executeCommand(Commands.OpenInRemote, uri, remotes, 'file', [gitUri.getRelativePath(), branch.name, gitUri.sha]); } catch (ex) { - Logger.error('[GitLens.OpenFileInRemoteCommand]', ex); + Logger.error(ex, 'OpenFileInRemoteCommand'); return window.showErrorMessage(`Unable to open file in remote provider. See output channel for more details`); } } diff --git a/src/commands/openInRemote.ts b/src/commands/openInRemote.ts index 69ca28c..caf5fe6 100644 --- a/src/commands/openInRemote.ts +++ b/src/commands/openInRemote.ts @@ -47,7 +47,7 @@ export class OpenInRemoteCommand extends ActiveEditorCommand { } catch (ex) { - Logger.error('[GitLens.OpenInRemoteCommand]', ex); + Logger.error(ex, 'OpenInRemoteCommand'); return window.showErrorMessage(`Unable to open in remote provider. See output channel for more details`); } } diff --git a/src/commands/showBlame.ts b/src/commands/showBlame.ts index 8ea3a9a..327eef9 100644 --- a/src/commands/showBlame.ts +++ b/src/commands/showBlame.ts @@ -19,7 +19,7 @@ export class ShowBlameCommand extends EditorCommand { return this.annotationController.showBlameAnnotation(editor, editor.selection.active.line); } catch (ex) { - Logger.error('GitLens.ShowBlameCommand', ex); + Logger.error(ex, 'ShowBlameCommand'); return window.showErrorMessage(`Unable to show blame annotations. See output channel for more details`); } } diff --git a/src/commands/showBlameHistory.ts b/src/commands/showBlameHistory.ts index 536e72c..fa9a2ea 100644 --- a/src/commands/showBlameHistory.ts +++ b/src/commands/showBlameHistory.ts @@ -32,7 +32,7 @@ export class ShowBlameHistoryCommand extends EditorCommand { return commands.executeCommand(BuiltInCommands.ShowReferences, uri, position, locations); } catch (ex) { - Logger.error('[GitLens.ShowBlameHistoryCommand]', 'getBlameLocations', ex); + Logger.error(ex, 'ShowBlameHistoryCommand', 'getBlameLocations'); return window.showErrorMessage(`Unable to show blame history. See output channel for more details`); } } diff --git a/src/commands/showFileHistory.ts b/src/commands/showFileHistory.ts index ae1c650..55a0b05 100644 --- a/src/commands/showFileHistory.ts +++ b/src/commands/showFileHistory.ts @@ -31,7 +31,7 @@ export class ShowFileHistoryCommand extends EditorCommand { return commands.executeCommand(BuiltInCommands.ShowReferences, uri, position, locations); } catch (ex) { - Logger.error('[GitLens.ShowFileHistoryCommand]', 'getLogLocations', ex); + Logger.error(ex, 'ShowFileHistoryCommand', 'getLogLocations'); return window.showErrorMessage(`Unable to show file history. See output channel for more details`); } } diff --git a/src/commands/showLastQuickPick.ts b/src/commands/showLastQuickPick.ts index b1f2734..2607067 100644 --- a/src/commands/showLastQuickPick.ts +++ b/src/commands/showLastQuickPick.ts @@ -17,7 +17,7 @@ export class ShowLastQuickPickCommand extends Command { return commands.executeCommand(command.command, ...command.args); } catch (ex) { - Logger.error('[GitLens.ShowLastQuickPickCommand]', ex); + Logger.error(ex, 'ShowLastQuickPickCommand'); return window.showErrorMessage(`Unable to show last quick pick. See output channel for more details`); } } diff --git a/src/commands/showQuickBranchHistory.ts b/src/commands/showQuickBranchHistory.ts index 8b2c74e..a3e0166 100644 --- a/src/commands/showQuickBranchHistory.ts +++ b/src/commands/showQuickBranchHistory.ts @@ -65,7 +65,7 @@ export class ShowQuickBranchHistoryCommand extends ActiveEditorCachedCommand { log); } catch (ex) { - Logger.error('[GitLens.ShowQuickBranchHistoryCommand]', ex); + Logger.error(ex, 'ShowQuickBranchHistoryCommand'); return window.showErrorMessage(`Unable to show branch history. See output channel for more details`); } finally { diff --git a/src/commands/showQuickCommitDetails.ts b/src/commands/showQuickCommitDetails.ts index 4f6f3e4..6b9b2ba 100644 --- a/src/commands/showQuickCommitDetails.ts +++ b/src/commands/showQuickCommitDetails.ts @@ -40,7 +40,7 @@ export class ShowQuickCommitDetailsCommand extends ActiveEditorCachedCommand { commit = blame.commit; } catch (ex) { - Logger.error('[GitLens.ShowQuickCommitDetailsCommand]', `getBlameForLine(${blameline})`, ex); + Logger.error(ex, 'ShowQuickCommitDetailsCommand', `getBlameForLine(${blameline})`); return window.showErrorMessage(`Unable to show commit details. See output channel for more details`); } } @@ -91,7 +91,7 @@ export class ShowQuickCommitDetailsCommand extends ActiveEditorCachedCommand { return commands.executeCommand(Commands.ShowQuickCommitFileDetails, pick.gitUri, pick.sha, undefined, currentCommand); } catch (ex) { - Logger.error('[GitLens.ShowQuickCommitDetailsCommand]', ex); + Logger.error(ex, 'ShowQuickCommitDetailsCommand'); return window.showErrorMessage(`Unable to show commit details. See output channel for more details`); } } diff --git a/src/commands/showQuickCommitFileDetails.ts b/src/commands/showQuickCommitFileDetails.ts index d30bfcf..9c0516d 100644 --- a/src/commands/showQuickCommitFileDetails.ts +++ b/src/commands/showQuickCommitFileDetails.ts @@ -38,7 +38,7 @@ export class ShowQuickCommitFileDetailsCommand extends ActiveEditorCachedCommand workingFileName = path.relative(commit.repoPath, gitUri.fsPath); } catch (ex) { - Logger.error('[GitLens.ShowQuickCommitFileDetailsCommand]', `getBlameForLine(${blameline})`, ex); + Logger.error(ex, 'ShowQuickCommitFileDetailsCommand', `getBlameForLine(${blameline})`); return window.showErrorMessage(`Unable to show commit file details. See output channel for more details`); } } @@ -90,7 +90,7 @@ export class ShowQuickCommitFileDetailsCommand extends ActiveEditorCachedCommand return undefined; } catch (ex) { - Logger.error('[GitLens.ShowQuickCommitFileDetailsCommand]', ex); + Logger.error(ex, 'ShowQuickCommitFileDetailsCommand'); return window.showErrorMessage(`Unable to show commit file details. See output channel for more details`); } } diff --git a/src/commands/showQuickCurrentBranchHistory.ts b/src/commands/showQuickCurrentBranchHistory.ts index 61d9fa5..ad5775e 100644 --- a/src/commands/showQuickCurrentBranchHistory.ts +++ b/src/commands/showQuickCurrentBranchHistory.ts @@ -22,7 +22,7 @@ export class ShowQuickCurrentBranchHistoryCommand extends ActiveEditorCachedComm return commands.executeCommand(Commands.ShowQuickBranchHistory, uri, branch, undefined, goBackCommand); } catch (ex) { - Logger.error('[GitLens.ShowQuickCurrentBranchHistoryCommand]', ex); + Logger.error(ex, 'ShowQuickCurrentBranchHistoryCommand'); return window.showErrorMessage(`Unable to show branch history. See output channel for more details`); } } diff --git a/src/commands/showQuickFileHistory.ts b/src/commands/showQuickFileHistory.ts index 0328b94..59cbb72 100644 --- a/src/commands/showQuickFileHistory.ts +++ b/src/commands/showQuickFileHistory.ts @@ -49,7 +49,7 @@ export class ShowQuickFileHistoryCommand extends ActiveEditorCachedCommand { log); } catch (ex) { - Logger.error('[GitLens.ShowQuickFileHistoryCommand]', 'data.repoPath, ', ex); + Logger.error(ex, 'ShowQuickFileHistoryCommand'); return window.showErrorMessage(`Unable to show file history. See output channel for more details`); } finally { diff --git a/src/commands/showQuickRepoStatus.ts b/src/commands/showQuickRepoStatus.ts index 01e4eb9..e662595 100644 --- a/src/commands/showQuickRepoStatus.ts +++ b/src/commands/showQuickRepoStatus.ts @@ -31,7 +31,7 @@ export class ShowQuickRepoStatusCommand extends ActiveEditorCachedCommand { } } catch (ex) { - Logger.error('[GitLens.ShowQuickRepoStatusCommand]', ex); + Logger.error(ex, 'ShowQuickRepoStatusCommand'); return window.showErrorMessage(`Unable to show repository status. See output channel for more details`); } } diff --git a/src/commands/toggleBlame.ts b/src/commands/toggleBlame.ts index 9b41c0a..dbf76c8 100644 --- a/src/commands/toggleBlame.ts +++ b/src/commands/toggleBlame.ts @@ -21,7 +21,7 @@ export class ToggleBlameCommand extends EditorCommand { return this.annotationController.toggleBlameAnnotation(editor, editor.selection.active.line); } catch (ex) { - Logger.error('GitLens.ToggleBlameCommand', ex); + Logger.error(ex, 'ToggleBlameCommand'); return window.showErrorMessage(`Unable to show blame annotations. See output channel for more details`); } } diff --git a/src/extension.ts b/src/extension.ts index d4b0585..e4ee11e 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -48,7 +48,7 @@ export async function activate(context: ExtensionContext) { repoPath = await Git.getRepoPath(rootPath, gitPath); } catch (ex) { - Logger.error(ex); + Logger.error(ex, 'Extension.activate'); if (ex.message.includes('Unable to find git')) { await window.showErrorMessage(`GitLens was unable to find Git. Please make sure Git is installed. Also ensure that Git is either in the PATH, or that 'gitlens.advanced.git' is pointed to its installed location.`); } diff --git a/src/git/git.ts b/src/git/git.ts index be178c9..56d072b 100644 --- a/src/git/git.ts +++ b/src/git/git.ts @@ -29,7 +29,7 @@ async function gitCommand(cwd: string, ...args: any[]) { Logger.warn('git', ...args, ` cwd='${cwd}'`, msg && `\n ${msg.replace(/\r?\n|\r/g, ' ')}`); } else { - Logger.error('git', ...args, ` cwd='${cwd}'`, msg && `\n ${msg.replace(/\r?\n|\r/g, ' ')}`); + Logger.error(ex, 'git', ...args, ` cwd='${cwd}'`, msg && `\n ${msg.replace(/\r?\n|\r/g, ' ')}`); } throw ex; } diff --git a/src/git/remotes/factory.ts b/src/git/remotes/factory.ts index ff0ff2f..818269d 100644 --- a/src/git/remotes/factory.ts +++ b/src/git/remotes/factory.ts @@ -25,7 +25,7 @@ export class RemoteProviderFactory { return creator(domain, path); } catch (ex) { - Logger.error(ex); + Logger.error(ex, 'RemoteProviderFactory'); return undefined; } } diff --git a/src/gitContentProvider.ts b/src/gitContentProvider.ts index 27e59b1..f1e908c 100644 --- a/src/gitContentProvider.ts +++ b/src/gitContentProvider.ts @@ -22,7 +22,7 @@ export class GitContentProvider implements TextDocumentContentProvider { return text; } catch (ex) { - Logger.error('[GitLens.GitContentProvider]', 'getVersionedFileText', ex); + Logger.error(ex, 'GitContentProvider', 'getVersionedFileText'); await window.showErrorMessage(`Unable to show Git revision ${data.sha.substring(0, 8)} of '${path.relative(data.repoPath, fileName)}'`); return undefined; } diff --git a/src/logger.ts b/src/logger.ts index 918a29c..0b741c3 100644 --- a/src/logger.ts +++ b/src/logger.ts @@ -50,13 +50,13 @@ export class Logger { } } - static error(message?: any, ...params: any[]): void { + static error(ex: Error, classOrMethod?: string, ...params: any[]): void { if (debug) { - console.error(ConsolePrefix, message, ...params); + console.error(ConsolePrefix, ex, ...params); } if (level !== OutputLevel.Silent) { - output.appendLine([message, ...params].join(' ')); + output.appendLine([ex, ...params].join(' ')); } }