create log channel

This commit is contained in:
bobo.yang 2023-05-09 08:52:07 +08:00
parent 925e871dce
commit 2eca8ee438
2 changed files with 17 additions and 0 deletions

View File

@ -9,10 +9,12 @@ import {
} from './contributes/commands';
import ExtensionContextHolder from './util/extensionContext';
import { logger } from './util/logger';
function activate(context: vscode.ExtensionContext) {
ExtensionContextHolder.context = context;
logger.init(context);
// 创建 .chat 目录并复制 instructions
createChatDirectoryAndCopyInstructionsSync(context.extensionUri);

15
src/util/logger.ts Normal file
View File

@ -0,0 +1,15 @@
import * as vscode from 'vscode'
export class logger {
private static _channel: vscode.OutputChannel | undefined;
public static init(context: vscode.ExtensionContext): void {
this._channel = vscode.window.createOutputChannel('DevChat');
this.log('DevChat is active');
}
public static log(text: string): void {
if (this._channel) {
this._channel.appendLine(text);
}
}
}