/*! © 2026 Yahoo, Inc. UDS Tailwind and Purger v0.0.0-development */
import { cyan, gray, green, magenta, red, yellow } from "./colors.js";
import { print } from "./print.js";
import { spinStart, spinStop } from "./spinner.js";

//#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) print(message);
		},
		printAlways: (message) => {
			print(message);
		},
		spinStart: (message) => {
			if (!isSilent) spinStart(message);
		},
		spinStop: (icon, message) => {
			if (!isSilent) spinStop(icon, message);
		},
		success: (message) => {
			if (!isSilent) print(green(`✅ ${message}`));
		},
		warn: (message) => {
			if (!isSilent) print(yellow(`⚠️  ${message}`));
		},
		error: (message) => {
			print(red(`❌ ${message}`));
		},
		info: (message) => {
			if (!isSilent) print(cyan(message));
		},
		label: (label, value) => {
			if (!isSilent) print(`${magenta(label)} ${cyan(value)}`);
		},
		listItem: (text) => {
			if (!isSilent) print(`   ${gray("•")} ${text}`);
		},
		timestamp: (message, color = "green") => {
			if (isSilent) return;
			const time = (/* @__PURE__ */ new Date()).toLocaleTimeString();
			const colorFn = color === "green" ? green : color === "yellow" ? yellow : red;
			print(`${gray(`[${time}]`)} ${colorFn(message)}`);
		},
		newline: () => {
			if (!isSilent) print("");
		},
		child: (childOptions = {}) => {
			return createLogger({ silent: childOptions.silent ?? isSilent });
		}
	};
}

//#endregion
export { createLogger };
//# sourceMappingURL=logger.js.map