Quick Start
Get up and running with LogStream in just a few minutes.
1. Create an account
Sign up for a free LogStream account at logstream.tech/signup
2. Get your API key
Navigate to Settings → API Keys and create a new key.
3. Install the SDK
Install the LogStream SDK for your platform.
4. Start logging
Initialize the SDK and start sending logs!
Installation
Install the LogStream SDK using your preferred package manager.
npm / yarn / pnpm
# npm
npm install @logstream/sdk
# yarn
yarn add @logstream/sdk
# pnpm
pnpm add @logstream/sdk
Python
pip install logstream
Configuration
Initialize the LogStream client with your API key.
JavaScript
import { LogStream } from '@logstream/sdk';
const logger = new LogStream({
apiKey: process.env.LOGSTREAM_API_KEY,
source: 'my-application',
environment: 'production',
// Optional settings
batchSize: 100,
flushInterval: 5000,
retryAttempts: 3
});
API Reference
Core methods available in the LogStream SDK.
logger.info(message, metadata?)
Log an informational message.
logger.warn(message, metadata?)
Log a warning message.
logger.error(message, metadata?)
Log an error message with stack trace support.
logger.debug(message, metadata?)
Log a debug message (only in development).
SDKs
Official SDKs for popular languages and frameworks.
Examples
Real-world examples to help you get started.
Express.js Middleware
import express from 'express';
import { LogStream } from '@logstream/sdk';
const app = express();
const logger = new LogStream({ apiKey: process.env.LOGSTREAM_API_KEY });
// Request logging middleware
app.use((req, res, next) => {
const start = Date.now();
res.on('finish', () => {
logger.info('HTTP Request', {
method: req.method,
path: req.path,
status: res.statusCode,
duration: Date.now() - start
});
});
next();
});