mirror of
https://github.com/cline/cline.git
synced 2026-09-17 17:45:33 +08:00
* Add Sentry package * Setup Logger to use Error Service * Update src/services/error/ErrorService.ts Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> --------- Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
38 lines
1.1 KiB
TypeScript
38 lines
1.1 KiB
TypeScript
import type { OutputChannel } from "vscode"
|
|
import { ErrorService } from "../error/ErrorService"
|
|
|
|
/**
|
|
* Simple logging utility for the extension's backend code.
|
|
* Uses VS Code's OutputChannel which must be initialized from extension.ts
|
|
* to ensure proper registration with the extension context.
|
|
*/
|
|
export class Logger {
|
|
private static outputChannel: OutputChannel
|
|
|
|
static initialize(outputChannel: OutputChannel) {
|
|
Logger.outputChannel = outputChannel
|
|
}
|
|
|
|
static error(message: string, exception?: Error) {
|
|
Logger.outputChannel.appendLine(`ERROR: ${message}`)
|
|
ErrorService.logMessage(message, "error")
|
|
exception && ErrorService.logException(exception)
|
|
}
|
|
static warn(message: string) {
|
|
Logger.outputChannel.appendLine(`WARN: ${message}`)
|
|
ErrorService.logMessage(message, "warning")
|
|
}
|
|
static log(message: string) {
|
|
Logger.outputChannel.appendLine(`LOG: ${message}`)
|
|
}
|
|
static debug(message: string) {
|
|
Logger.outputChannel.appendLine(`DEBUG: ${message}`)
|
|
}
|
|
static info(message: string) {
|
|
Logger.outputChannel.appendLine(`INFO: ${message}`)
|
|
}
|
|
static trace(message: string) {
|
|
Logger.outputChannel.appendLine(`TRACE: ${message}`)
|
|
}
|
|
}
|