/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
const require_colors = require("./colors.cjs");
const require_print = require("./print.cjs");
const require_spinner = require("./spinner.cjs");
//#region ../css/dist/packages/cli/dist/lib/logger.mjs
/*! © 2026 Yahoo, Inc. UDS CSS v0.0.0-development */
/*! © 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 {
		/** Whether the logger is in silent mode */
		isSilent,
		/** Print a message (respects silent mode) */
		print: (message) => {
			if (!isSilent) require_print.print(message);
		},
		/** Print without silent check (for errors that should always show) */
		printAlways: (message) => {
			require_print.print(message);
		},
		/** Start a spinner with message */
		spinStart: (message) => {
			if (!isSilent) require_spinner.spinStart(message);
		},
		/** Stop spinner with icon and message */
		spinStop: (icon, message) => {
			if (!isSilent) require_spinner.spinStop(icon, message);
		},
		/** Log success message */
		success: (message) => {
			if (!isSilent) require_print.print(require_colors.green(`✅ ${message}`));
		},
		/** Log warning message */
		warn: (message) => {
			if (!isSilent) require_print.print(require_colors.yellow(`⚠️  ${message}`));
		},
		/** Log error message (always shows, even in silent mode) */
		error: (message) => {
			require_print.print(require_colors.red(`❌ ${message}`));
		},
		/** Log info message */
		info: (message) => {
			if (!isSilent) require_print.print(require_colors.cyan(message));
		},
		/** Log a labeled value */
		label: (label, value) => {
			if (!isSilent) require_print.print(`${require_colors.magenta(label)} ${require_colors.cyan(value)}`);
		},
		/** Log a list item */
		listItem: (text) => {
			if (!isSilent) require_print.print(`   ${require_colors.gray("•")} ${text}`);
		},
		/** Log a timestamped message */
		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)}`);
		},
		/** Log an empty line */
		newline: () => {
			if (!isSilent) require_print.print("");
		},
		/** Create a child logger (inherits silent mode) */
		child: (childOptions = {}) => {
			return createLogger({ silent: childOptions.silent ?? isSilent });
		}
	};
}
//#endregion
exports.createLogger = createLogger;
