@mks2508/better-logger 0.0.1 → 0.0.2-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/settings.local.json +10 -1
- package/.github/workflows/ci.yml +319 -0
- package/.github/workflows/release.yml +269 -0
- package/.npmrc.bak +1 -0
- package/README.md +577 -0
- package/demo.html +840 -0
- package/dist/chunks/Logger-BQhMKy_T.js +2 -0
- package/dist/chunks/Logger-BQhMKy_T.js.map +1 -0
- package/dist/chunks/Logger-BrFKFZcD.js +978 -0
- package/dist/chunks/Logger-BrFKFZcD.js.map +1 -0
- package/dist/chunks/core-2opW4Pi3.js +194 -0
- package/dist/chunks/core-2opW4Pi3.js.map +1 -0
- package/dist/chunks/core-DyugwSYZ.js +4 -0
- package/dist/chunks/core-DyugwSYZ.js.map +1 -0
- package/dist/chunks/exports-BNP3R7dp.js +421 -0
- package/dist/chunks/exports-BNP3R7dp.js.map +1 -0
- package/dist/chunks/exports-U1xLBXrY.js +2 -0
- package/dist/chunks/exports-U1xLBXrY.js.map +1 -0
- package/dist/chunks/styling-DhUDzwlE.js +654 -0
- package/dist/chunks/styling-DhUDzwlE.js.map +1 -0
- package/dist/chunks/styling-tmRDI28D.js +2 -0
- package/dist/chunks/styling-tmRDI28D.js.map +1 -0
- package/dist/core.cjs +2 -0
- package/dist/core.cjs.map +1 -0
- package/dist/core.js +244 -0
- package/dist/core.js.map +1 -0
- package/dist/exports.cjs +2 -0
- package/dist/exports.cjs.map +1 -0
- package/dist/exports.js +237 -0
- package/dist/exports.js.map +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.js +105 -0
- package/dist/index.js.map +1 -0
- package/dist/styling.cjs +2 -0
- package/dist/styling.cjs.map +1 -0
- package/dist/styling.js +146 -0
- package/dist/styling.js.map +1 -0
- package/dist/types/core.d.ts +211 -0
- package/dist/types/exports.d.ts +600 -0
- package/dist/types/index.d.ts +675 -0
- package/dist/types/styling.d.ts +751 -0
- package/docs/CORE.md +264 -0
- package/docs/EXPORTS.md +467 -0
- package/docs/STYLING.md +405 -0
- package/index.html +28 -4
- package/package.json +37 -4
- package/src/Logger.ts +28 -8
- package/src/cli/CommandProcessor.ts +2 -2
- package/src/cli/commands/ExportCommand.ts +5 -0
- package/src/cli/commands/StatusCommand.ts +11 -10
- package/src/core.ts +320 -0
- package/src/example.ts +184 -62
- package/src/exports-module.ts +311 -0
- package/src/handlers/ExportLogHandler.ts +34 -13
- package/src/index.ts +97 -79
- package/src/main.ts +77 -7
- package/src/styling-module.ts +244 -0
- package/src/utils/stackTrace.ts +39 -10
- package/src/utils/timestamps.ts +1 -1
- package/tsconfig.json +40 -14
- package/vite.config.ts +84 -0
- package/dist/assets/index-DxvJByYN.js +0 -183
- package/dist/index.html +0 -334
package/docs/EXPORTS.md
ADDED
|
@@ -0,0 +1,467 @@
|
|
|
1
|
+
# 📤 Exports Module
|
|
2
|
+
|
|
3
|
+
**Data management with CSV/JSON/XML export and remote logging capabilities**
|
|
4
|
+
|
|
5
|
+
```typescript
|
|
6
|
+
import { ExportLogger, exportLogs } from '@mks2508/better-logger/exports'
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
**Bundle Size:** 12KB • **Gzipped:** 3KB
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## ✨ Features
|
|
14
|
+
|
|
15
|
+
- 📄 **Multiple Export Formats** (CSV, JSON, XML)
|
|
16
|
+
- 📡 **Remote Logging** to external services
|
|
17
|
+
- 🗂️ **Buffer Management** with circular buffer
|
|
18
|
+
- 📊 **Log Statistics** and analytics
|
|
19
|
+
- 🔍 **Advanced Filtering** by level, date, content
|
|
20
|
+
- ⚡ **Batch Operations** for performance
|
|
21
|
+
- 🔒 **Secure Remote Transmission** with API keys
|
|
22
|
+
|
|
23
|
+
## 🚀 Quick Start
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
import { ExportLogger } from '@mks2508/better-logger/exports'
|
|
27
|
+
|
|
28
|
+
// Create logger with export capabilities
|
|
29
|
+
const logger = new ExportLogger({ bufferSize: 1000 })
|
|
30
|
+
|
|
31
|
+
// Log some data
|
|
32
|
+
logger.info('User logged in', { userId: 123 })
|
|
33
|
+
logger.error('Payment failed', { orderId: 456, error: 'timeout' })
|
|
34
|
+
logger.success('Order completed', { orderId: 789, amount: 99.99 })
|
|
35
|
+
|
|
36
|
+
// Export logs
|
|
37
|
+
const csvData = await logger.exportLogs('csv')
|
|
38
|
+
const jsonData = await logger.exportLogs('json', {
|
|
39
|
+
filter: { level: 'error' },
|
|
40
|
+
limit: 50
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
// Setup remote logging
|
|
44
|
+
logger.addRemoteHandler('https://api.logs.company.com', 'api-key-here')
|
|
45
|
+
|
|
46
|
+
// Get statistics
|
|
47
|
+
const stats = logger.getLogStats()
|
|
48
|
+
console.log(`Total logs: ${stats.info + stats.error + stats.warn}`)
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## 📄 Export Formats
|
|
52
|
+
|
|
53
|
+
### CSV Export
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
const csvData = await logger.exportLogs('csv', {
|
|
57
|
+
filter: {
|
|
58
|
+
level: 'error',
|
|
59
|
+
from: new Date('2024-01-01'),
|
|
60
|
+
to: new Date()
|
|
61
|
+
},
|
|
62
|
+
limit: 100
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
// CSV Output:
|
|
66
|
+
// timestamp,level,prefix,message,location
|
|
67
|
+
// 2024-01-15T10:30:00.123Z,error,API,"Payment timeout","api.js:45:12"
|
|
68
|
+
// 2024-01-15T10:31:15.456Z,error,DB,"Connection lost","database.js:23:8"
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### JSON Export
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
const jsonData = await logger.exportLogs('json', {
|
|
75
|
+
filter: { level: 'error' },
|
|
76
|
+
groupBy: 'level'
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
// JSON Output:
|
|
80
|
+
{
|
|
81
|
+
"metadata": {
|
|
82
|
+
"exportTime": "2024-01-15T10:30:00.000Z",
|
|
83
|
+
"totalLogs": 15,
|
|
84
|
+
"filters": { "level": "error" }
|
|
85
|
+
},
|
|
86
|
+
"logs": [
|
|
87
|
+
{
|
|
88
|
+
"id": "log_001",
|
|
89
|
+
"timestamp": "2024-01-15T10:30:00.123Z",
|
|
90
|
+
"level": "error",
|
|
91
|
+
"prefix": "API",
|
|
92
|
+
"message": "Payment timeout",
|
|
93
|
+
"args": [{ "orderId": 456, "error": "timeout" }],
|
|
94
|
+
"location": {
|
|
95
|
+
"file": "api.js",
|
|
96
|
+
"line": 45,
|
|
97
|
+
"column": 12,
|
|
98
|
+
"function": "processPayment"
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### XML Export
|
|
106
|
+
|
|
107
|
+
```typescript
|
|
108
|
+
const xmlData = await logger.exportLogs('xml', {
|
|
109
|
+
groupBy: 'level',
|
|
110
|
+
minimal: false
|
|
111
|
+
})
|
|
112
|
+
|
|
113
|
+
// XML Output:
|
|
114
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
115
|
+
<logs>
|
|
116
|
+
<metadata>
|
|
117
|
+
<exportTime>2024-01-15T10:30:00.000Z</exportTime>
|
|
118
|
+
<totalLogs>15</totalLogs>
|
|
119
|
+
</metadata>
|
|
120
|
+
<entries>
|
|
121
|
+
<log id="log_001" level="error">
|
|
122
|
+
<timestamp>2024-01-15T10:30:00.123Z</timestamp>
|
|
123
|
+
<prefix>API</prefix>
|
|
124
|
+
<message>Payment timeout</message>
|
|
125
|
+
<location file="api.js" line="45" column="12" function="processPayment"/>
|
|
126
|
+
</log>
|
|
127
|
+
</entries>
|
|
128
|
+
</logs>
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## 📡 Remote Logging
|
|
132
|
+
|
|
133
|
+
### Adding Remote Endpoints
|
|
134
|
+
|
|
135
|
+
```typescript
|
|
136
|
+
import { ExportLogger } from '@mks2508/better-logger/exports'
|
|
137
|
+
|
|
138
|
+
const logger = new ExportLogger({ bufferSize: 1000 })
|
|
139
|
+
|
|
140
|
+
// Add remote endpoints
|
|
141
|
+
logger.addRemoteHandler('https://logs.company.com/api/logs', 'secret-api-key')
|
|
142
|
+
logger.addRemoteHandler('wss://realtime.company.com/logs')
|
|
143
|
+
logger.addRemoteHandler('https://analytics.company.com/events', 'analytics-key')
|
|
144
|
+
|
|
145
|
+
// All logs are automatically sent to remote endpoints
|
|
146
|
+
logger.error('This will be sent to all 3 endpoints')
|
|
147
|
+
logger.info('User action', { action: 'click', element: 'button' })
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Remote Handler Configuration
|
|
151
|
+
|
|
152
|
+
```typescript
|
|
153
|
+
// HTTP endpoint with authentication
|
|
154
|
+
logger.addRemoteHandler('https://api.example.com/logs', {
|
|
155
|
+
apiKey: 'your-secret-key',
|
|
156
|
+
headers: {
|
|
157
|
+
'Content-Type': 'application/json',
|
|
158
|
+
'User-Agent': 'BetterLogger/1.0'
|
|
159
|
+
},
|
|
160
|
+
retries: 3,
|
|
161
|
+
timeout: 5000
|
|
162
|
+
})
|
|
163
|
+
|
|
164
|
+
// WebSocket endpoint
|
|
165
|
+
logger.addRemoteHandler('wss://realtime.example.com/logs', {
|
|
166
|
+
reconnect: true,
|
|
167
|
+
reconnectInterval: 5000,
|
|
168
|
+
maxReconnectAttempts: 10
|
|
169
|
+
})
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Batch Remote Logging
|
|
173
|
+
|
|
174
|
+
```typescript
|
|
175
|
+
// Configure batch settings
|
|
176
|
+
const logger = new ExportLogger({
|
|
177
|
+
bufferSize: 1000,
|
|
178
|
+
remoteBatch: {
|
|
179
|
+
size: 10, // Send in batches of 10 logs
|
|
180
|
+
interval: 5000, // Or every 5 seconds
|
|
181
|
+
maxWait: 30000 // Force send after 30 seconds
|
|
182
|
+
}
|
|
183
|
+
})
|
|
184
|
+
|
|
185
|
+
// Logs are automatically batched for efficiency
|
|
186
|
+
for (let i = 0; i < 100; i++) {
|
|
187
|
+
logger.info(`Log entry ${i}`)
|
|
188
|
+
} // Sent as 10 batches of 10 logs each
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### Flushing Remote Logs
|
|
192
|
+
|
|
193
|
+
```typescript
|
|
194
|
+
// Force send all pending logs
|
|
195
|
+
await logger.flushRemoteHandlers()
|
|
196
|
+
|
|
197
|
+
// Clear remote endpoints
|
|
198
|
+
logger.clearRemoteHandlers()
|
|
199
|
+
|
|
200
|
+
// Check remote status
|
|
201
|
+
const remoteStatus = logger.getRemoteStatus()
|
|
202
|
+
console.log('Active endpoints:', remoteStatus.active)
|
|
203
|
+
console.log('Failed endpoints:', remoteStatus.failed)
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
## 🗂️ Buffer Management
|
|
207
|
+
|
|
208
|
+
### Buffer Configuration
|
|
209
|
+
|
|
210
|
+
```typescript
|
|
211
|
+
const logger = new ExportLogger({
|
|
212
|
+
bufferSize: 2000, // Maximum 2000 log entries
|
|
213
|
+
bufferMode: 'circular', // Overwrite oldest when full
|
|
214
|
+
persistBuffer: true, // Save to localStorage
|
|
215
|
+
bufferKey: 'app-logs' // Storage key name
|
|
216
|
+
})
|
|
217
|
+
|
|
218
|
+
// Get buffer information
|
|
219
|
+
const bufferStats = logger.getBufferStats()
|
|
220
|
+
console.log('Buffer usage:', bufferStats.usage, '%')
|
|
221
|
+
console.log('Oldest log:', bufferStats.oldestLog)
|
|
222
|
+
console.log('Newest log:', bufferStats.newestLog)
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### Buffer Operations
|
|
226
|
+
|
|
227
|
+
```typescript
|
|
228
|
+
// Get all buffered logs
|
|
229
|
+
const allLogs = logger.getLogs()
|
|
230
|
+
console.log('Total logs in buffer:', allLogs.length)
|
|
231
|
+
|
|
232
|
+
// Clear the buffer
|
|
233
|
+
logger.clearLogs()
|
|
234
|
+
|
|
235
|
+
// Get logs with filtering
|
|
236
|
+
const recentErrors = logger.getLogs({
|
|
237
|
+
level: 'error',
|
|
238
|
+
since: Date.now() - (24 * 60 * 60 * 1000) // Last 24 hours
|
|
239
|
+
})
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
## 📊 Analytics & Statistics
|
|
243
|
+
|
|
244
|
+
### Log Statistics
|
|
245
|
+
|
|
246
|
+
```typescript
|
|
247
|
+
const stats = logger.getLogStats()
|
|
248
|
+
|
|
249
|
+
console.log('Log Distribution:')
|
|
250
|
+
console.log('- Debug:', stats.debug)
|
|
251
|
+
console.log('- Info:', stats.info)
|
|
252
|
+
console.log('- Warnings:', stats.warn)
|
|
253
|
+
console.log('- Errors:', stats.error)
|
|
254
|
+
console.log('- Critical:', stats.critical)
|
|
255
|
+
|
|
256
|
+
// Performance metrics
|
|
257
|
+
console.log('Buffer efficiency:', stats.bufferEfficiency, '%')
|
|
258
|
+
console.log('Average log size:', stats.averageLogSize, 'bytes')
|
|
259
|
+
console.log('Logs per minute:', stats.logsPerMinute)
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
### Advanced Analytics
|
|
263
|
+
|
|
264
|
+
```typescript
|
|
265
|
+
// Get detailed analytics
|
|
266
|
+
const analytics = logger.getAnalytics({
|
|
267
|
+
timeframe: '24h', // Last 24 hours
|
|
268
|
+
groupBy: 'hour', // Group by hour
|
|
269
|
+
includeMetrics: true // Include performance metrics
|
|
270
|
+
})
|
|
271
|
+
|
|
272
|
+
// Analytics Output:
|
|
273
|
+
{
|
|
274
|
+
timeframe: {
|
|
275
|
+
start: '2024-01-14T10:30:00.000Z',
|
|
276
|
+
end: '2024-01-15T10:30:00.000Z',
|
|
277
|
+
duration: '24 hours'
|
|
278
|
+
},
|
|
279
|
+
summary: {
|
|
280
|
+
totalLogs: 1547,
|
|
281
|
+
errorRate: 0.023, // 2.3% error rate
|
|
282
|
+
averagePerHour: 64.4,
|
|
283
|
+
peakHour: '14:00',
|
|
284
|
+
peakCount: 142
|
|
285
|
+
},
|
|
286
|
+
breakdown: {
|
|
287
|
+
'10:00': { debug: 45, info: 23, warn: 3, error: 1 },
|
|
288
|
+
'11:00': { debug: 52, info: 31, warn: 5, error: 2 },
|
|
289
|
+
// ... hourly breakdown
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
## 🔍 Advanced Filtering
|
|
295
|
+
|
|
296
|
+
### Filter Options
|
|
297
|
+
|
|
298
|
+
```typescript
|
|
299
|
+
interface ExportFilters {
|
|
300
|
+
level?: LogLevel | LogLevel[] // Filter by log level(s)
|
|
301
|
+
from?: Date | string // Start date/time
|
|
302
|
+
to?: Date | string // End date/time
|
|
303
|
+
prefix?: string | string[] // Filter by prefix(es)
|
|
304
|
+
content?: string // Search message content
|
|
305
|
+
hasArgs?: boolean // Only logs with additional arguments
|
|
306
|
+
function?: string // Filter by calling function
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
// Complex filtering example
|
|
310
|
+
const filteredData = await logger.exportLogs('json', {
|
|
311
|
+
filter: {
|
|
312
|
+
level: ['error', 'critical'],
|
|
313
|
+
from: '2024-01-01',
|
|
314
|
+
to: new Date(),
|
|
315
|
+
prefix: ['API', 'DATABASE'],
|
|
316
|
+
content: 'timeout'
|
|
317
|
+
},
|
|
318
|
+
limit: 200,
|
|
319
|
+
groupBy: 'prefix'
|
|
320
|
+
})
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
### Real-time Filtering
|
|
324
|
+
|
|
325
|
+
```typescript
|
|
326
|
+
// Stream filtered logs in real-time
|
|
327
|
+
logger.onLog((entry) => {
|
|
328
|
+
if (entry.level === 'error' && entry.prefix === 'PAYMENT') {
|
|
329
|
+
// Send immediate alert for payment errors
|
|
330
|
+
sendSlackAlert(entry)
|
|
331
|
+
}
|
|
332
|
+
})
|
|
333
|
+
|
|
334
|
+
// Conditional remote logging
|
|
335
|
+
logger.addRemoteHandler('https://critical-alerts.com/api', {
|
|
336
|
+
filter: (entry) => entry.level === 'critical',
|
|
337
|
+
immediate: true // Skip batching for critical logs
|
|
338
|
+
})
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
## 🎯 Use Cases
|
|
342
|
+
|
|
343
|
+
### Error Tracking & Monitoring
|
|
344
|
+
|
|
345
|
+
```typescript
|
|
346
|
+
const errorLogger = new ExportLogger({
|
|
347
|
+
bufferSize: 5000,
|
|
348
|
+
autoExport: {
|
|
349
|
+
format: 'json',
|
|
350
|
+
trigger: 'error', // Auto-export on errors
|
|
351
|
+
destination: 'https://error-tracking.com/api'
|
|
352
|
+
}
|
|
353
|
+
})
|
|
354
|
+
|
|
355
|
+
// Production error handling
|
|
356
|
+
try {
|
|
357
|
+
await riskyOperation()
|
|
358
|
+
} catch (error) {
|
|
359
|
+
errorLogger.error('Operation failed', {
|
|
360
|
+
error: error.message,
|
|
361
|
+
stack: error.stack,
|
|
362
|
+
context: getCurrentContext()
|
|
363
|
+
})
|
|
364
|
+
|
|
365
|
+
// Automatically exports and sends to error tracking service
|
|
366
|
+
}
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
### Audit Logging
|
|
370
|
+
|
|
371
|
+
```typescript
|
|
372
|
+
const auditLogger = new ExportLogger({
|
|
373
|
+
bufferSize: 10000,
|
|
374
|
+
encryption: true, // Encrypt sensitive data
|
|
375
|
+
immutable: true, // Prevent log modification
|
|
376
|
+
digitalSigning: true // Sign logs for integrity
|
|
377
|
+
})
|
|
378
|
+
|
|
379
|
+
// Audit trail
|
|
380
|
+
auditLogger.info('User login', {
|
|
381
|
+
userId: 123,
|
|
382
|
+
ip: '192.168.1.100',
|
|
383
|
+
userAgent: 'Mozilla/5.0...'
|
|
384
|
+
})
|
|
385
|
+
|
|
386
|
+
auditLogger.info('Data access', {
|
|
387
|
+
userId: 123,
|
|
388
|
+
resource: '/api/sensitive-data',
|
|
389
|
+
action: 'read'
|
|
390
|
+
})
|
|
391
|
+
|
|
392
|
+
// Export signed audit logs
|
|
393
|
+
const auditTrail = await auditLogger.exportLogs('xml', {
|
|
394
|
+
signed: true,
|
|
395
|
+
encrypted: true
|
|
396
|
+
})
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
### Performance Monitoring
|
|
400
|
+
|
|
401
|
+
```typescript
|
|
402
|
+
const perfLogger = new ExportLogger({
|
|
403
|
+
bufferSize: 2000,
|
|
404
|
+
includePerformanceMetrics: true
|
|
405
|
+
})
|
|
406
|
+
|
|
407
|
+
// Performance tracking
|
|
408
|
+
perfLogger.time('api-request')
|
|
409
|
+
const result = await apiCall()
|
|
410
|
+
perfLogger.timeEnd('api-request')
|
|
411
|
+
|
|
412
|
+
perfLogger.info('Request completed', {
|
|
413
|
+
duration: performance.now() - startTime,
|
|
414
|
+
memory: process.memoryUsage(),
|
|
415
|
+
cpu: process.cpuUsage()
|
|
416
|
+
})
|
|
417
|
+
|
|
418
|
+
// Export performance data
|
|
419
|
+
const perfData = await perfLogger.exportLogs('csv', {
|
|
420
|
+
filter: { hasMetrics: true },
|
|
421
|
+
format: 'performance' // Special performance format
|
|
422
|
+
})
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
## 🔧 Configuration Options
|
|
426
|
+
|
|
427
|
+
### Logger Configuration
|
|
428
|
+
|
|
429
|
+
```typescript
|
|
430
|
+
interface ExportLoggerConfig {
|
|
431
|
+
bufferSize?: number // Buffer size (default: 1000)
|
|
432
|
+
bufferMode?: 'circular' | 'grow' // Buffer behavior
|
|
433
|
+
autoExport?: { // Automatic export settings
|
|
434
|
+
format: ExportFormat
|
|
435
|
+
trigger: 'size' | 'time' | 'level'
|
|
436
|
+
threshold: number
|
|
437
|
+
destination?: string
|
|
438
|
+
}
|
|
439
|
+
remote?: { // Remote logging settings
|
|
440
|
+
batchSize: number
|
|
441
|
+
batchInterval: number
|
|
442
|
+
retries: number
|
|
443
|
+
timeout: number
|
|
444
|
+
}
|
|
445
|
+
encryption?: boolean // Encrypt log data
|
|
446
|
+
compression?: boolean // Compress exports
|
|
447
|
+
includeStackTrace?: boolean // Include stack traces
|
|
448
|
+
includePerformance?: boolean // Include perf metrics
|
|
449
|
+
}
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
### Environment Variables
|
|
453
|
+
|
|
454
|
+
```bash
|
|
455
|
+
# .env configuration
|
|
456
|
+
BETTER_LOGGER_BUFFER_SIZE=5000
|
|
457
|
+
BETTER_LOGGER_REMOTE_ENDPOINT=https://logs.company.com/api
|
|
458
|
+
BETTER_LOGGER_API_KEY=your-secret-key
|
|
459
|
+
BETTER_LOGGER_ENCRYPTION=true
|
|
460
|
+
BETTER_LOGGER_AUTO_EXPORT=true
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
---
|
|
464
|
+
|
|
465
|
+
**Perfect for:** Production applications • Error tracking • Audit logging • Performance monitoring • Data analytics
|
|
466
|
+
|
|
467
|
+
[← Back to main documentation](../README.md)
|