feat(export): introduce LogExporter interface
- Dominant language
- Jupyter Notebook
- Stars
- 30
- Forks
- 15
- PR merge metrics
- No merged PRs in 30d
Description
## Summary
Refactor `sendLogs.ts` into a pluggable `LogExporter` interface. This is the architectural keystone for OTLP support and custom export targets.
## Motivation
Currently `sendLogs.ts` tightly couples batch management, transport (XHR/fetch/sendBeacon), and auth header construction. This makes it impossible to add new output formats (OTLP, custom backends) without duplicating the batch logic.
## Proposed Interface
```typescript
interface LogExporter {
export(logs: Logging.Log[]): Promise;
flush(): Promise;
shutdown(): Promise;
}
```
## Implementation
- `src/exporters/types.ts` — LogExporter interface
- `src/exporters/http-json.ts` — Extract current sendLogs behavior (default)
- `src/exporters/websocket.ts` — Extract current WebSocket behavior
- `src/exporters/index.ts` — Factory: config → exporter
- `src/sendLogs.ts` — Simplified to batch manager + exporter.export()
## Config Changes
```typescript
exporterType?: 'http-json' | 'otlp' | 'websocket' | 'custom';
exporter?: LogExporter; // for custom exporters
```
## Backward Compatibility
Existing users who set `url: 'https://my-server/logs'` must work identically. `HttpJsonExporter` is the default. No config change needed.
## Depends On
- v2.5.0 release (foundation)
- #137 (toolchain modernization)
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reading src/sendLogs.ts and tracing its current batch, transport, and authentication responsibilities. Review the proposed files—src/exporters/types.ts, src/exporters/http-json.ts, src/exporters/websocket.ts, and src/exporters/index.ts—along with the configuration changes. Done means the default HTTP JSON and WebSocket behaviors remain compatible while the exporter interface and custom exporter path are available; note that v2.5.0 and #137 are dependencies.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100