Transports
Configure where your logs are sent.
Overview
Transports define log destinations. Vestig includes five built-in transports:
| Transport | Description | Best For |
|---|---|---|
ConsoleTransport | Output to console with colors | Development, debugging |
HTTPTransport | Send to HTTP endpoint | Log aggregation services |
FileTransport | Write to files with rotation | Server-side persistence |
DatadogTransport | Direct Datadog integration | Datadog Log Management |
SentryTransport | Direct Sentry integration | Error tracking, alerting |
Using Multiple Transports
Send logs to multiple destinations:
typescript
Common Transport Options
All transports share these options:
typescript
Level Filtering
Each transport can have its own level:
typescript
Custom Filtering
typescript
ConsoleTransport
Pretty console output with colors:
typescript
Output Formats
Pretty mode (development):
text
Structured mode (production):
json
HTTPTransport
Send logs to any HTTP endpoint:
typescript
Error Handling
typescript
FileTransport
Write logs to files with automatic rotation:
typescript
Date Patterns
Use %DATE% in filename for daily rotation:
typescript
DatadogTransport
Direct integration with Datadog Log Management:
typescript
SentryTransport
Direct integration with Sentry for error tracking and monitoring:
typescript
Key Features
- DSN Parsing: Supports both Sentry cloud and self-hosted instances
- Level Filtering: Only sends
warnanderrorby default (configurable viaminLevel) - Error Serialization: Automatically converts errors to Sentry exception format with stack traces
- Trace Context: Propagates
traceIdandspanIdfor distributed tracing - Tags: Key-value pairs for filtering and searching in Sentry
Configuration Options
| Option | Type | Description |
|---|---|---|
dsn | string | Required. Sentry DSN from your project settings |
environment | string | Environment name (e.g., 'production', 'staging') |
release | string | Application version for release tracking |
service | string | Service name (added as tag) |
serverName | string | Server hostname identifier |
tags | Record<string, string> | Additional tags for filtering |
minLevel | LogLevel | Minimum level to send (default: 'warn') |
Creating Custom Transports
Extend BatchTransport for efficient custom transports:
typescript
Related
- Getting Started — Quick setup guide
- Sampling — Control log volume
- PII Sanitization — Protect sensitive data