const environment: string = process.env.NODE_ENV || "Unknown";

const hideInProduction: string[] = ["info", "dbug"];

async function out(msg: string, level = "othr") {
  if (
    environment === "production" &&
    hideInProduction.includes(level.toLowerCase())
  ) {
    return;
  } else {
    const time = new Date().toISOString();
    console.log(`${time} - ${level.toUpperCase()} - ${msg}`);
  }
}

module.exports = {
  out,
};

export { out };
