import { ILogger } from "../types";

export class ConsoleLogger implements ILogger {
  info(message: string, meta?: any) {
    console.log(`[INFO] ${message}`, meta ?? "");
  }

  warn(message: string, meta?: any) {
    console.warn(`[WARN] ${message}`, meta ?? "");
  }

  error(message: string, error?: Error | any) {
    console.error(`[ERROR] ${message}`, error?.stack || error);
  }

  debug(message: string, meta?: any) {
    console.debug(`[DEBUG] ${message}`, meta ?? "");
  }
}

export const createConsoleLogger = (): ILogger => new ConsoleLogger();
