itsfadnis / datadog-winston

Ship winston logs to datadog without breaking a sweat

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error: Missing required option: `apiKey`

dabelega opened this issue · comments

I get this error: Error: Missing required option: apiKey when I initialize the library. Here's what I'm doing.

import winston from 'winston';
import DatadogWinston from 'datadog-winston';

const logger = winston.createLogger({
  format: winston.format.json(),
  level: 'trace',
});

logger.add(
  new DatadogWinston({
    apiKey: DATADOG_API_KEY,
    service: 'client-service',
  }),
);

@dhaniboy09 you're probably not passing a valid apiKey on initialization. Fix that and you should be good to go 👍