ConsoleLogger (utils/logger.ts)

AFFiNE · blocksuite/framework/global/src/utils/logger.ts · typescript · MIT
infra, tag:knn-classified

Simple console‑based logger implementing debug/info/warn/error, plus a no‑op variant.

// Source: https://github.com/toeverything/AFFiNE | License: MIT | Copyright 2022-present TOEVERYTHING PTE. LTD. and its affiliates
// Provided via justclaw.it.com; keep this notice with the code.
export interface Logger {
  debug: (message: string, ...args: unknown[]) => void;
  info: (message: string, ...args: unknown[]) => void;
  warn: (message: string, ...args: unknown[]) => void;
  error: (message: string, ...args: unknown[]) => void;
}

export class ConsoleLogger implements Logger {
  debug(message: string, ...args: unknown[]) {
    console.debug(message, ...args);
  }

  error(message: string, ...args: unknown[]) {
    console.error(message, ...args);
  }

  info(message: string, ...args: unknown[]) {
    console.info(message, ...args);
  }

  warn(message: string, ...args: unknown

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key