UNPKG

@levimc-lse/scaffold

Version:

A utility for assisting in the development of Legacy Script Engine plugins.

30 lines (29 loc) 1.11 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CliLogger = void 0; class CliLogger { constructor(methodName) { this.methodName = methodName; } success(msg) { console.log(`✅ ${CliLogger.TOOL_NAME}::${this.methodName}: ${msg}`); } error(error) { let suggestionString = ""; if (error.getSuggestion().length === 1) { suggestionString += `Suggestion: ${error.getSuggestion()[0]}`; } else { suggestionString += "Suggestions:\n"; let solutionIndex = 1; for (const solution of error.getSuggestion()) { suggestionString += ` ${solutionIndex}. ${solution}\n`; solutionIndex++; } suggestionString = suggestionString.slice(0, -2); // Remove the last newline. } console.error(`❌ ${CliLogger.TOOL_NAME}::${this.methodName}: ${error.constructor.name} - ${error.getMessage()}\n ${suggestionString}`); } } exports.CliLogger = CliLogger; CliLogger.TOOL_NAME = "legacy-script-engine-scaffold";