Replace default logger
# crawlee-js
n
Hello, did anybody manage to completely replace the logs from Crawlee with console logs ? If yes, can you please share your implementation ?
h
Someone will reply to you shortly. In the meantime, this might help:
c
you can extend the log class and write your own
_log
method
Copy code
typescript
/* eslint-disable @typescript-eslint/no-explicit-any */
import { LogLevel, Logger, LoggerOptions } from '@crawlee/playwright';

export class CustomLogger extends Logger {
  constructor(
    options: LoggerOptions,
  ) {
    super(options);
  }

  override _log(
    level: LogLevel,
    message: string,
    data?: any,
    exception?: unknown,
    opts?: Record<string, any>,
  ): void {

  }
}
then you can inject it into the global config
Copy code
ts
  log.setOptions({
    logger: new CustomLogger(log.getOptions()),
  });