-
-
Notifications
You must be signed in to change notification settings - Fork 84
Migrate logging from custom Logger to LogTape #554
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,7 +1,7 @@ | ||||||
| // SPDX-License-Identifier: MIT | ||||||
| import * as vscode from 'vscode'; | ||||||
| import { SemVer } from 'semver'; | ||||||
| import { Logger } from './logger'; | ||||||
| import { getExtensionLogger } from './logging'; | ||||||
|
|
||||||
| interface PackageJSON { | ||||||
| version: string; | ||||||
|
|
@@ -13,15 +13,16 @@ export class ExtensionManager { | |||||
| private extensionID: string; | ||||||
| private packageJSON: PackageJSON; | ||||||
| private extensionPath: string; | ||||||
| private logger: Logger; | ||||||
| private readonly logger = getExtensionLogger('Core', 'ExtensionManager'); | ||||||
|
|
||||||
| constructor(context: vscode.ExtensionContext, extensionID: string, logger: Logger) { | ||||||
| constructor(context: vscode.ExtensionContext, extensionID: string) { | ||||||
| this.context = context; | ||||||
| this.extensionID = extensionID; | ||||||
| this.logger = logger; | ||||||
| const extension = vscode.extensions.getExtension(this.extensionID); | ||||||
| if (!extension) { | ||||||
| throw new Error(`Extension ${extensionID} not found`); | ||||||
| const errorMessage = `Extension ${extensionID} not found`; | ||||||
| this.logger.fatal("Extension not found", { extensionId: extensionID }); | ||||||
|
||||||
| this.logger.fatal("Extension not found", { extensionId: extensionID }); | |
| this.logger.fatal(errorMessage, { extensionId: extensionID }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error logging loses stack trace information. The previous implementation logged both the error message and stack trace separately, which is helpful for debugging. Consider including stack trace in the properties object when err is an Error instance.