type LogLevel = 'log' | 'info' | 'debug' | 'warn' | 'error';

export class Logger {
   constructor(
      private readonly prefix: string = '',
   ) {
   }

   #doLog(method: LogLevel, ...args: any[]) {
      console[method](`[js-filters${this.prefix ? ' ' + this.prefix: ''}]`, ...args);
   }

   log(...args: any[]) {
      this.#doLog('log', ...args);
   }

   info(...args: any[]) {
      this.#doLog('info', ...args);
   }

   debug(...args: any[]) {
      this.#doLog('debug', ...args);
   }

   warn(...args: any[]) {
      this.#doLog('warn', ...args);
   }

   error(...args: any[]) {
      this.#doLog('error', ...args);
   }
}
