Skip to main content
Client logs help you understand user behavior and debug issues in production.

Logging with Beacon

import { Beacon } from '@kodo-status/beacon';

const beacon = new Beacon({
  key: 'bpk_your_key',
  service: 'my-app'
});

// Log levels
beacon.log('debug', 'Component mounted', { component: 'Header' });
beacon.log('info', 'User clicked checkout');
beacon.log('warn', 'API response slow', { duration: 3500 });
beacon.log('error', 'Payment failed', { reason: 'declined' });

Log Levels

LevelUse Case
debugDevelopment debugging, verbose info
infoNormal operations, user actions
warnPotential issues, degraded performance
errorFailures that need attention

Structured Logging

Include structured data for better searching:
beacon.log('info', 'Order placed', {
  orderId: 'ord_123',
  total: 99.99,
  items: 3,
  paymentMethod: 'card'
});

User Context

Logs automatically include user context if set:
beacon.setUser({
  id: 'user_123',
  email: '[email protected]'
});

// All logs now include this user info
beacon.log('info', 'Settings updated');

Viewing Logs

View logs in Dashboard > Beacon > Logs:
  • Filter by level, service, time range
  • Search log messages and data
  • Group by user or session
  • Export for analysis

Log Retention

PlanRetention
Starter7 days
Pro30 days
Team90 days

Best Practices

Focus on events that help debugging: user actions, API calls, state changes.
Add relevant data like IDs, counts, and durations.
Reserve error for actual failures, use warn for issues that don’t block users.
Never log passwords, tokens, or PII.