// src/runtime/ConsoleLogger.ts

import type { IRuntimeLogger } from './IRuntimeLogger';

export class ConsoleLogger implements IRuntimeLogger {
  constructor(private enabled: boolean = true, private prefix: string = '[Matrix]') {}

  debug(message: string, ...args: unknown[]): void {
    // eslint-disable-next-line no-console -- logger implementation
    if (this.enabled) console.log(`${this.prefix} DEBUG: ${message}`, ...args);
  }
  info(message: string, ...args: unknown[]): void {
    // eslint-disable-next-line no-console -- logger implementation
    if (this.enabled) console.log(`${this.prefix} INFO: ${message}`, ...args);
  }
  warn(message: string, ...args: unknown[]): void {
    // eslint-disable-next-line no-console -- logger implementation
    console.warn(`${this.prefix} WARN: ${message}`, ...args);
  }
  error(message: string, error?: Error): void {
    // eslint-disable-next-line no-console -- logger implementation
    console.error(`${this.prefix} ERROR: ${message}`, error);
  }
  disable(): void { this.enabled = false; }
  enable(): void { this.enabled = true; }
}

export class NullLogger implements IRuntimeLogger {
  debug(): void {}
  info(): void {}
  warn(): void {}
  error(): void {}
  disable(): void {}
  enable(): void {}
}
