Path: blob/main/extensions/markdown-language-features/src/logging.ts
3292 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45import * as vscode from 'vscode';6import { Disposable } from './util/dispose';789export interface ILogger {10trace(title: string, message: string, data?: any): void;11}1213export class VsCodeOutputLogger extends Disposable implements ILogger {14private _outputChannelValue?: vscode.LogOutputChannel;1516private get _outputChannel() {17this._outputChannelValue ??= this._register(vscode.window.createOutputChannel('Markdown', { log: true }));18return this._outputChannelValue;19}2021constructor() {22super();23}2425public trace(title: string, message: string, data?: any): void {26this._outputChannel.trace(`${title}: ${message}`, ...(data ? [JSON.stringify(data, null, 4)] : []));27}28}293031