/*! © 2026 Yahoo, Inc. UDS Tailwind and Purger v0.0.0-development */
const require_colors = require('./colors.cjs');
const require_print = require('./print.cjs');
const require_spinner = require('./spinner.cjs');

//#region ../cli/dist/lib/logger.mjs
/*! © 2026 Yahoo, Inc. UDS CLI v0.0.0-development */
/**
* Logger utility for CLI commands.
* Centralizes logging behavior with support for silent mode.
*/
/**
* Create a logger instance with optional silent mode.
* When silent, all logging methods become no-ops.
*/
function createLogger(options = {}) {
	const isSilent = options.silent ?? false;
	return {
		isSilent,
		print: (message) => {
			if (!isSilent) require_print.print(message);
		},
		printAlways: (message) => {
			require_print.print(message);
		},
		spinStart: (message) => {
			if (!isSilent) require_spinner.spinStart(message);
		},
		spinStop: (icon, message) => {
			if (!isSilent) require_spinner.spinStop(icon, message);
		},
		success: (message) => {
			if (!isSilent) require_print.print(require_colors.green(`✅ ${message}`));
		},
		warn: (message) => {
			if (!isSilent) require_print.print(require_colors.yellow(`⚠️  ${message}`));
		},
		error: (message) => {
			require_print.print(require_colors.red(`❌ ${message}`));
		},
		info: (message) => {
			if (!isSilent) require_print.print(require_colors.cyan(message));
		},
		label: (label, value) => {
			if (!isSilent) require_print.print(`${require_colors.magenta(label)} ${require_colors.cyan(value)}`);
		},
		listItem: (text) => {
			if (!isSilent) require_print.print(`   ${require_colors.gray("•")} ${text}`);
		},
		timestamp: (message, color = "green") => {
			if (isSilent) return;
			const time = (/* @__PURE__ */ new Date()).toLocaleTimeString();
			const colorFn = color === "green" ? require_colors.green : color === "yellow" ? require_colors.yellow : require_colors.red;
			require_print.print(`${require_colors.gray(`[${time}]`)} ${colorFn(message)}`);
		},
		newline: () => {
			if (!isSilent) require_print.print("");
		},
		child: (childOptions = {}) => {
			return createLogger({ silent: childOptions.silent ?? isSilent });
		}
	};
}

//#endregion
exports.createLogger = createLogger;