Skip to main content

Basic Setup

Minimal Configuration

With Startup Message

Production Setup

Full Production Configuration

Development Setup

Development Configuration

Custom Logging

Structured Logging with Context

Child Loggers

Performance Logging

Error Handling

Automatic Error Logging

Custom Error Handler

Elysia 2 removed the code string from the error context — narrow with instanceof, or register a per-class handler with .error(MyError, fn):

JSON Format for Error Logs

Output for both regular requests and errors will be in JSON format:

Custom Transports

Elasticsearch Transport

Slack Transport (Errors Only)

MongoDB Transport

Environment-Based Configuration

Dynamic Configuration

REST API Example

Complete REST API with Logging