import chalk from "chalk";
import logSymbols from "log-symbols";
import { getConsoleLogPrefix } from "./getConsoleLogPrefix.js";
const clockChar = "\u25f7";
export default async function withStatusLogs(messageAndOptions, callback) {
    if (typeof messageAndOptions !== "string" && messageAndOptions.disableLogs)
        return await callback();
    console.log(getConsoleLogPrefix() + `${chalk.cyan(clockChar)} ${typeof messageAndOptions === "string" ? messageAndOptions : messageAndOptions.loading}`);
    try {
        const res = await callback();
        if (typeof messageAndOptions !== "string")
            console.log(getConsoleLogPrefix() + `${logSymbols.success} ${messageAndOptions.success}`);
        else
            console.log(getConsoleLogPrefix() + `${logSymbols.success} ${messageAndOptions}`);
        return res;
    }
    catch (er) {
        if (typeof messageAndOptions !== "string")
            console.log(getConsoleLogPrefix() + `${logSymbols.error} ${messageAndOptions.fail}`);
        else
            console.log(getConsoleLogPrefix() + `${logSymbols.error} ${messageAndOptions}`);
        throw er;
    }
}
//# sourceMappingURL=withStatusLogs.js.map