Перейти к основному содержанию

Documentation Index

Fetch the complete documentation index at: https://wiki.oquiz.net/llms.txt

Use this file to discover all available pages before exploring further.

Format

The logger uses pino’s positional-argument signature.
  • With context: logger.warn({ userId, error }, 'Failed to update user');
  • Without context: logger.warn('Sentry is disabled in local environment');
The message is always the last positional argument. Never put it inside the context object as msg:.

Capitalization

Every message starts with a capital letter — including template literals.
logger.info({count}, 'Processed feedback batch');
logger.error({key, error}, `Failed to restore entry: ${key}`);

Errors

Use the key error. It is consistent across services and serializes well with pino’s default errSerializer.
try {
  await save();
} catch (error) {
  logger.error({id, error}, 'Failed to save game dump');
}

Levels

  • trace / debug — local development noise.
  • info — routine state changes worth keeping in production logs (startup, job progress, successful background work).
  • warn — recoverable failures, degraded paths, fallbacks.
  • error — operations that failed and are not retried internally.
  • fatal — process is going down.

Anti-patterns

// Don't put the message inside the context object.
logger.error({msg: 'failed to save', error});

// Don't pass the error as a second positional arg.
logger.warn(`Invalid color: ${color}`, error);

// Don't use lowercase messages.
logger.info('user signed in');

// Don't mix `err` and `error` keys — use `error`.
logger.error({err});