import { EventType, Outcome } from "../types/logging.js";
import recordLog from "./recordLog.js";

/**
 * Logs a message with a general event type and completed outcome. Prefer more specific logging functions when available.
 * @param args The message to log.
 * @returns {Promise<void>} A promise that resolves when the log is recorded.
 */
export async function log(...args: unknown[]): Promise<void> {
    // use the same logic as console.log to format the message
    const message = args.map((arg: unknown) => {
        return String(arg);
    }).join(" ");

    return await recordLog(message, {
        eventType: "general" as EventType,
        outcome: Outcome.COMPLETED
    });
}