mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-30 08:40:29 -04:00
Merge from vscode 2f984aad710215f4e4684a035bb02f55d1a9e2cc (#9819)
This commit is contained in:
@@ -7,11 +7,23 @@ import * as vscode from 'vscode';
|
||||
|
||||
type LogLevel = 'Trace' | 'Info' | 'Error';
|
||||
|
||||
enum Level {
|
||||
Trace = 'trace',
|
||||
Info = 'Info'
|
||||
}
|
||||
|
||||
class Log {
|
||||
private output: vscode.OutputChannel;
|
||||
private level: Level;
|
||||
|
||||
constructor() {
|
||||
this.output = vscode.window.createOutputChannel('Account');
|
||||
this.level = vscode.workspace.getConfiguration('microsoftAccount').get('logLevel') || Level.Info;
|
||||
vscode.workspace.onDidChangeConfiguration(e => {
|
||||
if (e.affectsConfiguration('microsoftAccount.logLevel')) {
|
||||
this.level = vscode.workspace.getConfiguration('microsoftAccount').get('logLevel') || Level.Info;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private data2String(data: any): string {
|
||||
@@ -32,6 +44,12 @@ class Log {
|
||||
this.logLevel('Error', message, data);
|
||||
}
|
||||
|
||||
public trace(message: string, data?: any): void {
|
||||
if (this.level === Level.Trace) {
|
||||
this.logLevel('Trace', message, data);
|
||||
}
|
||||
}
|
||||
|
||||
public logLevel(level: LogLevel, message: string, data?: any): void {
|
||||
this.output.appendLine(`[${level} - ${this.now()}] ${message}`);
|
||||
if (data) {
|
||||
|
||||
Reference in New Issue
Block a user