Skip to content

createShelfLogger

createShelfLogger(options?): Logger

Defined in: packages/core/src/logger.ts:24

Create the structured JSON logger used across StoryShelf.

Logging conventions:

  • Always log structured objects, never interpolate into the message: logger.info({ projectId, buildId }, "build started").
  • Attach errors as an err child field rather than stringifying into the message: logger.error({ err }, "capture failed").
  • Derive scoped child loggers for background work: const captureLogger = logger.child({ buildId }).

The default sink is stdout. The level resolves as explicit option, then the LOG_LEVEL environment variable, then "info" — so LOG_LEVEL=debug configures a default-constructed logger with no code changes. Unknown levels throw at construction (fail fast on typos). Hosted observability platforms (Sentry, PostHog, Datadog, GCP, OTEL collector, etc.) are added as pino worker transports — they are sinks for this logger, not standalone loggers.

LoggerOptions = {}

Logger