@heap-dk/datadog-log-standard-attribute-types
TypeScript icon, indicating that this package has built-in type declarations

1.2.0 • Public • Published

datadog-log-standard-attribute-types

This module exposes Typescript types for Datadog's default standard attribute list for structured logging.

Assembled from data from:

Installation

npm install --save-dev @heap-dk/datadog-log-standard-attribute-types

Usage

import { DD_META_STRUCTURE } from '@heap-dk/datadog-log-standard-attribute-types';

// See https://docs.datadoghq.com/logs/log_collection/?tab=host#logging-endpoints
const DD_API_URL = new URL(`https://http-intake.logs.datadoghq.eu/v1/input`);

function myDatadogLogger(message: string, context: DD_META_STRUCTURE) {
    fetch(API_URL.toString(), {
        method: 'POST',
        headers: {
            'Content-Type': 'application/json',
            'DD-API-KEY': DD_API_KEY,
        },
        body: JSON.stringify({
            ...context,
            message,
        }),
  })
}

LICENSE

MIT

Package Sidebar

Install

npm i @heap-dk/datadog-log-standard-attribute-types

Weekly Downloads

97

Version

1.2.0

License

MIT

Unpacked Size

26 kB

Total Files

8

Last publish

Collaborators

  • munter
  • fini