1. Quick Start
TraceStack provides a zero-dependency Node.js SDK that makes logging extremely fast and entirely asynchronous. First, install the package using your preferred package manager:
npm install @trace-stack/nodeNext, initialize the logger at the entry point of your application:
import { logger } from "@trace-stack/node";
logger.init({
apiKey: "your_project_api_key",
service: "api-server",
flushIntervalMs: 2000, // Optional: defaults to 3000ms
});2. Logging Events
Once initialized, you can log events from anywhere in your codebase. The SDK supports five log levels: debug, info, warn, error, and fatal.
logger.info("User signed in", {
userId: "usr_123",
method: "oauth",
provider: "github"
});
try {
await chargeStripe(userId, amount);
} catch (err) {
logger.error("Payment failed", {
userId,
amount,
error: err.message
});
}Zero Performance Penalty.The SDK batches all logs in memory and sends them asynchronously. Your application's response time is completely unaffected by logging.
3. REST API (Advanced)
If you are using a language other than Node.js, you can send logs directly to the Ingestion API.
POST https://ingest.tracestack.dev/api/v1/logs/batch
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
{\n "logs": [\n {\n "level": "info",\n "message": "User signed up",\n "service": "api-server",\n "timestamp": "2026-06-20T12:00:00.000Z",\n "metadata": { ... }\n }\n ]\n}