azurite
Version:
An open source Azure Storage API compatible server
30 lines • 1.05 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
const vscode_1 = require("vscode");
const ILoggerStrategy_1 = require("./ILoggerStrategy");
/**
* A logger strategy can log to Visual Studio Code channel.
*
* @export
* @class VSCChannelLoggerStrategy
* @implements {ILoggerStrategy}
*/
class VSCChannelLoggerStrategy {
/**
* Creates an instance of VSCChannelLoggerStrategy.
*
* @param {string} channelName Log to specific channel
* @param {LogLevels} [level=LogLevels.Debug]
* @memberof VSCChannelLoggerStrategy
*/
constructor(channelName, level = ILoggerStrategy_1.LogLevels.Debug) {
this.channelName = channelName;
this.level = level;
this.channel = vscode_1.window.createOutputChannel(channelName);
}
log(level, message, contextID = "\t") {
this.channel.appendLine(`${new Date().toISOString()} ${contextID} ${level} ${message}`);
}
}
exports.default = VSCChannelLoggerStrategy;
//# sourceMappingURL=VSCChannelLoggerStrategy.js.map
;