See all logs with the same trace ID, ordered by time
Copy
Ask AI
Error: Cannot read property 'id' of undefined────────────────────────────────────────────trace_id: a1b2c3d4...Related Logs (4):────────────────────────────────────────────14:23:45.123 info User logged in user_id=12314:23:46.456 info Loading user profile user_id=12314:23:47.789 warn Profile cache miss user_id=12314:23:48.012 error Failed to fetch user data status=50014:23:48.015 [ERROR OCCURRED HERE]
When both logging and error tracking are enabled, correlation happens automatically:
Copy
Ask AI
Proliferate.init({ endpoint: 'https://api.proliferate.com/api/v1/errors', apiKey: 'pk_your_api_key', logs: { enabled: true, },});// These logs share a trace IDProliferate.logger.info('Starting checkout');Proliferate.logger.info('Validating cart', { items: 3 });Proliferate.logger.info('Processing payment');// When this error is captured, all logs above are linkedtry { await processPayment();} catch (error) { Proliferate.captureException(error); // Error includes trace_id, linking it to the logs}
const traceId = Proliferate.getTraceId();// Include in API requestsfetch('/api/checkout', { headers: { 'X-Trace-ID': traceId, },});// Include in your own logsmyLogger.info('Processing request', { trace_id: traceId });// Include in support ticketsshowError(`Something went wrong. Reference: ${traceId}`);
In Single Page Applications, the trace ID resets on navigation:
Copy
Ask AI
// Initial page load// trace_id: aaa111...Proliferate.logger.info('Home page loaded');// User navigates to /dashboard (popstate event)// trace_id: bbb222... (new trace)Proliferate.logger.info('Dashboard loaded');// User navigates to /profile// trace_id: ccc333... (new trace)Proliferate.logger.info('Profile loaded');
Each “page” in your SPA gets its own trace ID, keeping logs organized by user journey.
When an error is captured, logs are immediately flushed to ensure correlation:
Copy
Ask AI
try { await riskyOperation();} catch (error) { // These logs are guaranteed to be sent with the error Proliferate.logger.error('Operation failed', { details }); Proliferate.captureException(error); // Logs are flushed immediately, not waiting for interval}
Proliferate.logger.info('Processing order', { orderId: order.id, userId: user.id, amount: order.total,});// When viewing the error, you'll see exactly which order failed