Skip to main content

@rtorcato/api-logger v1.1.1

Interfaces​

CreateLoggerOptions​

Defined in: index.ts:4

Extends​

  • LoggerOptions

Properties​

pretty?​

optional pretty?: boolean

Defined in: index.ts:10

Pretty-print human-readable logs via pino-pretty. Defaults to true when NODE_ENV !== 'production'. Requires pino-pretty to be installed (optional peer dependency).

prettyOptions?​

optional prettyOptions?: Record<string, unknown>

Defined in: index.ts:16

Options forwarded to pino-pretty when pretty is on, e.g. { colorize: true, singleLine: true, translateTime: 'HH:MM:ss', ignore: 'pid,hostname' }. Ignored when pretty is false or a destination is supplied.

Functions​

createLogger()​

createLogger(options?, destination?): Logger

Defined in: index.ts:29

Create a configured pino logger.

Framework-agnostic — wrap it for Hono/Express in a dedicated adapter package. Level defaults to LOG_LEVEL env var, then info.

Parameters​

options?​

CreateLoggerOptions = {}

pino options plus a pretty toggle.

destination?​

DestinationStream

optional pino destination stream; when supplied it wins over the pretty transport (useful for tests and custom sinks).

Returns​

Logger