@ultraops/pino
v0.2.0
Published
Pino transport for shipping logs to UltraOps
Maintainers
Readme
@ultraops/pino
Pino transport that ships your application logs to UltraOps.
Install
npm install @ultraops/pino pinoUsage
import pino from 'pino';
const logger = pino({
transport: {
targets: [
// Local console output
{ target: 'pino-pretty', level: 'debug' },
// Ship to UltraOps
{
target: '@ultraops/pino',
options: {
apiKey: process.env.ULTRAOPS_LOG_KEY,
source: 'api-server',
},
level: 'info',
},
],
},
});
logger.info({ userId: 'u_42' }, 'User logged in');
logger.error({ err, orderId: 'ORD-123' }, 'Payment failed');Options
| Option | Type | Default | Description |
|---|---|---|---|
| apiKey | string | required | UltraOps API key (uo_log_...) |
| endpoint | string | https://logs.ultraops.ai/v1/ingest | Ingest endpoint URL |
| source | string | undefined | Service name sent as the source field |
| batchSize | number | 50 | Flush when buffer reaches this size |
| flushIntervalMs | number | 5000 | Max ms before flushing a partial batch |
| maxRetries | number | 2 | Retry attempts for failed flushes |
How it works
- Buffers log entries and flushes in batches (default: 50 entries or every 5 seconds)
- Maps Pino numeric levels to UltraOps levels (
debug,info,warn,error,fatal) - Sends
msgas the log message,nameorsourceoption as the source - All other fields (request IDs, user IDs, etc.) are sent as searchable metadata
- Retries on network errors and 429 (rate limit) with exponential backoff
- Never throws or crashes your app on logging failures
License
MIT
