Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/extensions/markdown-language-features/src/logging.ts
3292 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import * as vscode from 'vscode';
7
import { Disposable } from './util/dispose';
8
9
10
export interface ILogger {
11
trace(title: string, message: string, data?: any): void;
12
}
13
14
export class VsCodeOutputLogger extends Disposable implements ILogger {
15
private _outputChannelValue?: vscode.LogOutputChannel;
16
17
private get _outputChannel() {
18
this._outputChannelValue ??= this._register(vscode.window.createOutputChannel('Markdown', { log: true }));
19
return this._outputChannelValue;
20
}
21
22
constructor() {
23
super();
24
}
25
26
public trace(title: string, message: string, data?: any): void {
27
this._outputChannel.trace(`${title}: ${message}`, ...(data ? [JSON.stringify(data, null, 4)] : []));
28
}
29
}
30
31