boltZharp Docs
codeLogs

From your code

Log from inside your app with the Zharp SDK for your language. Turn tracing off and it sends logs and errors only — with the user and session each line belongs to.

There is one Zharp SDK per platform, and the same SDK does logs and full App Telemetry. If you only want logs, start it with tracing off: three steps, below. You can turn tracing on later without changing anything else.

lightbulb

Already printing to stdout or a log file on a server? The agent collects that without any code. Use an SDK when you want structured lines with the user and session on them, or logs from a browser or a phone.

Get a key

The SDKs send with an app's key, so create an app once — it takes a minute:

  1. 1
    Add an app

    In the dashboard sidebar, open App Telemetry and click Add app. Pick your platform and give the app a name — say Checkout API. Its service name (checkout-api) is what your logs are filed under.

  2. 2
    Copy the key

    Click Create app. The next step shows the setup code with the key (zpk_…) and service name filled in; the key is also in the app's settings later. It can only send data, so it is safe in a web page or a mobile app. You don't have to finish the Verify step.

  3. 3
    Start the SDK with tracing off

    Use the snippet for your language below in place of the setup code's init.

On a server you can use a workspace API key instead — Integrations & API → Main API keys with Ingest only. Then the service you set picks the app with that service name, or creates a discovered app for it. Logs from the agent, log sources and the HTTP API need no app at all.

Logs only, per language

import { Zharp } from "@zharp/browser";

Zharp.init({
  key: "zpk_…",
  service: "checkout-web",
  tracing: false,
});

Zharp.log.info("Checkout started", { cartSize: 3 });
@zharp/browser — install: npm install @zharp/browser · More: Logs on the Browser page

What you get

  • Your lines on the Logs page under the app's service name, with search, levels and live tail, next to the logs from everywhere else.
  • The same lines on the app's Logs tab under App Telemetry, each with the user and session it came from.
  • Uncaught errors and crashes, grouped into issues on the app's Errors tab.
  • Who: call setUser after sign-in and every line carries the user — see each SDK's User context.

With tracing off there are no spans: no request timings, no traces across front end and API, and no trace headers on your requests. Remove the option to get them.

Other languages

  • Any OpenTelemetry SDK can send its logs to Zharp over OTLP — set it up as an OpenTelemetry app and only configure the logs exporter. See OpenTelemetry.
  • Or post lines yourself to the HTTP API.

Next