Logged Docs
Logged Docs

Getting Started

  • Installation
  • Quick Start

SDK

  • Logger
  • Capture Errors
  • Browser Auto Capture
  • Console Capture

REST API

  • Overview

Examples

  • Next.js
  • React
  • JavaScript
Back to site

Installation

Add Logged to your application in minutes. The SDK is lightweight, works in the browser and Node.js, and sends logs to the Logged API.

Install the SDK

bash
npm install @logged/sdk

This installs the @logged/sdk package into your project.

Initialize the client

typescript
import { Logged } from "@logged/sdk";

const logger = new Logged({
  apiKey: process.env.LOGGED_API_KEY!,
});

API key

You can find your API key in the Logged dashboard under Project → Settings → API Key.

Send a log

typescript
logger.info("Application started");

That's enough to send your first log. Open the dashboard to see it appear in real time.

Configuration options

The Logged constructor accepts the following options:

PropertyRequiredDescription
apiKeyYesProject API key from the dashboard.
environmentNoApplication environment, for example development, staging, or production.
baseUrlNoLogged API URL. Defaults to the app URL.
debugNoEnable SDK debug logging to the browser or Node console.

Where to store your API key

Security

Never commit API keys to source control. Use environment variables or a secrets manager instead.

For server-side applications, use a standard environment variable such as LOGGED_API_KEY. For browser applications, prefix the variable with NEXT_PUBLIC_ or VITE_ so it is available at runtime.

Next steps

Once Logged is installed, follow the Quick Start to create a project and send your first log.

Quick StartExplore the SDK