import * as env from "@lib/env.ts";
import { ensureDir } from "https://deno.land/std@0.224.0/fs/mod.ts";
import { join } from "node:path";
import { getLogLevel, LOG_LEVEL } from "@lib/log/types.ts";

export const LOG_DIR = join(env.DATA_DIR, "logs");

// Ensure the log directory exists
await ensureDir(LOG_DIR);

export let logLevel = getLogLevel(env.LOG_LEVEL);
export function setLogLevel(level: LOG_LEVEL) {
  logLevel = level;
}
