UNPKG

openapi-mock-generator-cli

Version:
37 lines (36 loc) 1.33 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Logger = void 0; const colorette_1 = require("colorette"); /** * Returns the current timestamp formatted as a string. */ function getCurrentTimestamp() { const now = new Date(); return now.toLocaleString('en-US', { dateStyle: 'short', timeStyle: 'medium' }); } /** * A utility class for logging messages with different levels of severity. * Each log message is prefixed with a timestamp and a color-coded label. */ class Logger { static info(...message) { this.mainLog(`${(0, colorette_1.blueBright)('[INFO]')} ${(0, colorette_1.cyanBright)(String(message))}`); } static success(...message) { this.mainLog(`${(0, colorette_1.greenBright)('[SUCCESS]')} ${(0, colorette_1.greenBright)(String(message))}`); } static warn(...message) { this.mainLog(`${(0, colorette_1.yellowBright)('[WARN]')} ${(0, colorette_1.yellowBright)(String(message))}`); } static error(...message) { this.mainLog(`${(0, colorette_1.redBright)('[ERROR]')} ${(0, colorette_1.redBright)(String(message))}`); } static mainLog(...message) { console.log(`${(0, colorette_1.cyanBright)(`[${getCurrentTimestamp()}]`)} ${message.join(' ')}`); } } exports.Logger = Logger;