export function createLogger(loggerPrefix: string | (() => Promise<string>)) {
  const getLoggerPrefix: () => Promise<string> =
    typeof loggerPrefix === "string" ? async () => loggerPrefix : loggerPrefix

  return {
    async debug(message: string, ...args: unknown[]): Promise<void> {
      console.debug(`[${await getLoggerPrefix()}] ${message}`, ...args)
    },
    async warn(message: string, ...args: unknown[]): Promise<void> {
      console.warn(`[${await getLoggerPrefix()}] Warning - ${message}`, ...args)
    },
    async error(message: string, ...args: unknown[]): Promise<void> {
      console.error(`[${await getLoggerPrefix()}] Error - ${message}`, ...args)
    },
  }
}
