SDKs

SDKs

Official open-source SDKs for Node.js, Python, Go, .NET, Java, Rust, Ruby and PHP that send logs and metrics to Logdash.

The SDKs send logs and metrics from your servers, workers and scripts. They are open source and work the same way in every language: create a client with your ingest key, then call a method per log level and per metric operation.

Install

npm install @logdash/node

Send your first log

Copy the ingest key from Settings of your domain and keep it in LOGDASH_API_KEY.

import { Logdash } from '@logdash/node';

const logdash = new Logdash(process.env.LOGDASH_API_KEY);

logdash.info('Application started successfully');
logdash.error('An unexpected error occurred');
logdash.warn('Low disk space warning');

What every SDK does

  • Sends logs at the seven levels, from error to silly.
  • Sets a metric or changes it by a number. See Set or change.
  • Sends events to web analytics, next to the visits of your website.
  • Names the app that sends, such as api or worker. See Apps.

No SDK for your language

Any language that makes HTTP requests can send logs and metrics. See the HTTP API.

curl -X POST https://api.logdash.io/logs \
  -H "project-api-key: $LOGDASH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"message": "Application started successfully", "level": "info", "createdAt": "'"$(date -u +%FT%TZ)"'"}'

The SDKs are for servers. To measure the visitors of a website, add the web analytics tracker instead.