JS SDK Reference
Messages

Messages

Send custom log messages to Traceway for tracking non-error events.

captureMessage

Send a simple text message:

import { captureMessage } from "@tracewayapp/frontend";
 
// Track important events
captureMessage("User completed onboarding");
 
// Track business metrics
captureMessage("Payment processed successfully");
 
// Track navigation
captureMessage("User visited pricing page");

Use Cases

User Actions

function handlePurchase(product) {
  captureMessage(`Purchase: ${product.name}`);
  // ... process purchase
}

Feature Usage

function enableBetaFeature(featureName) {
  captureMessage(`Beta feature enabled: ${featureName}`);
  // ... enable feature
}

Debugging Production Issues

function processData(data) {
  if (data.items.length > 1000) {
    captureMessage(`Large dataset processed: ${data.items.length} items`);
  }
  // ... process data
}

Messages vs Exceptions

Use captureMessage whenUse captureException when
Tracking user actionsAn error occurred
Logging business eventsCatching exceptions
Debugging production flowsSomething unexpected happened
Monitoring feature usageOperation failed

Best Practices

  1. Be concise: Messages should be short and descriptive
  2. Include context: Add relevant identifiers when helpful
  3. Avoid sensitive data: Never include passwords, tokens, or PII
  4. Use sparingly: Messages add overhead; don't log every action

Viewing Messages

Messages appear in the Traceway dashboard alongside exceptions. You can filter by message type to see only messages or only exceptions.