Files
vscode/extensions/markdown-language-features/src/logging.ts
Matt Bierner 7df46143a1 Experiment with switching markdown extension to use native privates
Let's try this out with one extension to start
2026-03-10 23:13:16 -07:00

30 lines
1021 B
TypeScript

/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as vscode from 'vscode';
import { Disposable } from './util/dispose';
export interface ILogger {
trace(title: string, message: string, data?: any): void;
}
export class VsCodeOutputLogger extends Disposable implements ILogger {
#outputChannelValue?: vscode.LogOutputChannel;
get #outputChannel() {
this.#outputChannelValue ??= this._register(vscode.window.createOutputChannel('Markdown', { log: true }));
return this.#outputChannelValue;
}
constructor() {
super();
}
public trace(title: string, message: string, data?: any): void {
this.#outputChannel.trace(`${title}: ${message}`, ...(data ? [JSON.stringify(data, null, 4)] : []));
}
}