Transports
Configure where your logs are sent.
Overview
Transports define log destinations. Vestig includes four 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 |
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
Creating Custom Transports
Extend BatchTransport for efficient custom transports:
typescript
Next Steps
- Console Transport — Detailed console options
- HTTP Transport — HTTP configuration and error handling
- File Transport — File rotation and compression
- Datadog Transport — Datadog integration details
- Custom Transports — Build your own transport