Docs
Install
Deno

Deno

This Guide Integrates:  Logs

Currently only supports OpenTelemetry Logging. For tracing support, see the following guide (opens in a new tab).

Logging

Logging is supported by exporting a custom logger for the std/log module.

Example usage:

import * as log from 'https://deno.land/std@0.203.0/log/mod.ts';
import { OpenTelemetryHandler } from 'npm:@hyperdx/deno';
 
log.setup({
  handlers: {
    otel: new OpenTelemetryHandler('DEBUG'),
  },
 
  loggers: {
    'my-otel-logger': {
      level: 'DEBUG',
      handlers: ['otel'],
    },
  },
});
 
log.getLogger('my-otel-logger').info('Hello from Deno!');

Run the Application

OTEL_EXPORTER_OTLP_HEADERS="authorization=<YOUR_INGESTION_KEY>" \
OTEL_EXPORTER_OTLP_ENDPOINT=https://in-otel.hyperdx.io \
OTEL_SERVICE_NAME="<NAME_OF_YOUR_APP_OR_SERVICE>" \
deno run --allow-net --allow-env --allow-read --allow-sys --allow-run app.ts

Hi, how can I help you?