Skip to main content

Functions

logixlysia

Main plugin function that adds logging capabilities to your Elysia application.
Parameters:
  • options (optional): Configuration options for Logixlysia
Returns:
  • Logixlysia: Elysia instance with logging capabilities
Example:

Types

Logixlysia

Elysia instance type with Logixlysia store.
The plugin uses an explicit LogixlysiaSingleton: a closed store plus empty decorator / derive / resolve slots that avoid both SingletonBase’s wide Record<string, unknown> and Record<string, never> (the latter would intersect Elysia’s Context keys with never). That keeps Context and WebSocket ws.data precise after .use(logixlysia()).

Options

Configuration options for Logixlysia.

LogixlysiaStore

Store type available in Elysia context.
Properties:
  • logger: Logger instance with helper methods
  • pino: Direct Pino logger instance
  • beforeTime: Request start time (bigint)
Keep LogixlysiaStore a closed object type (no index signature). That helps merged handler and WebSocket types stay accurate.

Logger

Logger interface with logging methods.

LogLevel

Log level type.

Transport

Custom transport interface.

LogRotationConfig

Log rotation configuration.

Pino

Pino logger type.

LogixlysiaContext

Context type for request handlers.

Classes

HttpError

An HTTP error carrying the context that makes a failure actionable.
Properties:
  • status — HTTP status code
  • code — stable machine-readable identifier the client can branch on, e.g. PAYMENT_DECLINED. Unlike message, it is safe to depend on: rewording the message does not break a caller
  • why — why the request failed, in plain language
  • fix — what the caller should do about it
  • link — documentation URL for this failure
  • internallog-only diagnostics. Non-enumerable and excluded from toJSON(), so no serializer can put it in a response body
Example:
Response body:
The log line carries the same fields plus internal, rendered in the context tree as error.code, error.why, error.fix, error.link, and error.internal. An error with no client-facing fields keeps its previous behaviour exactly — throw new HttpError(404, 'User not found') still responds with the bare message, not JSON. Only an error carrying at least one of code, why, fix, or link responds as JSON.

Usage Examples

Accessing Logger in Route Handlers

Custom Logging