Blyp Docs

Expo

Expo is a mobile/client integration rather than a server adapter. Use it when you want Blyp logs from an Expo app to sync directly to your backend.

Install

Install the package and the Expo network module:

bun add @blyp/core
npx expo install expo-network

Basic setup

import { createExpoLogger } from "@blyp/core/expo";

const logger = createExpoLogger({
  endpoint: "https://api.example.com/inngest",
  metadata: () => ({
    app: "mobile",
  }),
  delivery: {
    maxRetries: 3,
    retryDelayMs: 5000,
  },
});

logger.info("mounted", { screen: "home" });
logger.error(new Error("Failed to load profile"));
logger.child({ feature: "checkout" }).warn("Validation failed");

Important Expo-specific behavior

Retryable Expo failures include:

When Expo connectivity returns, Blyp resumes queued delivery through the expo-network state listener.

Local console vs remote sync

const logger = createExpoLogger({
  endpoint: "https://api.example.com/inngest",
  localConsole: true,
  remoteSync: true,
});

localConsole defaults to true and remoteSync defaults to true.

Connector forwarding requests

Expo can request server-side forwarding into PostHog, Sentry, or a named OTLP target:

const logger = createExpoLogger({
  endpoint: "https://api.example.com/inngest",
  connector: "posthog",
});
const logger = createExpoLogger({
  endpoint: "https://api.example.com/inngest",
  connector: "sentry",
});
const logger = createExpoLogger({
  endpoint: "https://api.example.com/inngest",
  connector: { type: "otlp", name: "grafana" },
});

Expo still posts to Blyp first. Blyp forwards only when the matching server connector is configured and ready.

Delivery hooks

Expo supports the same delivery lifecycle callbacks as the browser logger:

const logger = createExpoLogger({
  endpoint: "https://api.example.com/inngest",
  delivery: {
    onRetry: (ctx) => {
      console.log("retry", ctx.attempt, ctx.reason);
    },
    onSuccess: (ctx) => {
      console.log("success", ctx.transport);
    },
    onFailure: (ctx) => {
      console.log("failure", ctx.reason);
    },
    onDrop: (ctx) => {
      console.log("dropped", ctx.droppedEvent.message);
    },
  },
});

These hooks are useful when you want to monitor mobile delivery health, surface diagnostics in development builds, or measure how often events are being queued and replayed.

Payload shape

Expo emits a client log payload with the same base structure as @blyp/core/client, but includes Expo-specific device data:

{
  type: "client_log",
  source: "client",
  device: {
    runtime: "expo",
    network: {
      type: "WIFI",
      isConnected: true,
      isInternetReachable: true,
    },
  },
}

Child loggers share the same in-memory dispatcher and queue, so .child() keeps delivery behavior consistent across screens and features.

Relevant types

import type {
  ExpoLogger,
  ExpoLoggerConfig,
  ClientConnectorRequest,
  ClientLogEvent,
  ClientLogLevel,
  ClientLogDeviceContext,
  RemoteDeliveryConfig,
  RemoteDeliveryRetryContext,
  RemoteDeliverySuccessContext,
  RemoteDeliveryFailureContext,
  RemoteDeliveryDropContext,
} from "@blyp/core/expo";

Use Connectors for the corresponding server-side PostHog, Sentry, and OTLP setup.