-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updating to the latest extension template.
- Loading branch information
1 parent
e6ce660
commit 96e6fad
Showing
14 changed files
with
344 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
import * as util from 'util'; | ||
import { Disposable, LogOutputChannel } from 'vscode'; | ||
|
||
type Arguments = unknown[]; | ||
class OutputChannelLogger { | ||
constructor(private readonly channel: LogOutputChannel) {} | ||
|
||
public traceLog(...data: Arguments): void { | ||
this.channel.appendLine(util.format(...data)); | ||
} | ||
|
||
public traceError(...data: Arguments): void { | ||
this.channel.error(util.format(...data)); | ||
} | ||
|
||
public traceWarn(...data: Arguments): void { | ||
this.channel.warn(util.format(...data)); | ||
} | ||
|
||
public traceInfo(...data: Arguments): void { | ||
this.channel.info(util.format(...data)); | ||
} | ||
|
||
public traceVerbose(...data: Arguments): void { | ||
this.channel.debug(util.format(...data)); | ||
} | ||
} | ||
|
||
let channel: OutputChannelLogger | undefined; | ||
export function registerLogger(logChannel: LogOutputChannel): Disposable { | ||
channel = new OutputChannelLogger(logChannel); | ||
return { | ||
dispose: () => { | ||
channel = undefined; | ||
}, | ||
}; | ||
} | ||
|
||
export function traceLog(...args: Arguments): void { | ||
channel?.traceLog(...args); | ||
} | ||
|
||
export function traceError(...args: Arguments): void { | ||
channel?.traceError(...args); | ||
} | ||
|
||
export function traceWarn(...args: Arguments): void { | ||
channel?.traceWarn(...args); | ||
} | ||
|
||
export function traceInfo(...args: Arguments): void { | ||
channel?.traceInfo(...args); | ||
} | ||
|
||
export function traceVerbose(...args: Arguments): void { | ||
channel?.traceVerbose(...args); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.