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/sdkThis 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:
| Property | Required | Description |
|---|---|---|
| apiKey | Yes | Project API key from the dashboard. |
| environment | No | Application environment, for example development, staging, or production. |
| baseUrl | No | Logged API URL. Defaults to the app URL. |
| debug | No | Enable 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.