ovhemert / pino-datadog

🌲A transport for pino that sends messages to DataDog
MIT License
36 stars 24 forks source link

Debug logging does not work #95

Closed AlexBroadbent closed 1 year ago

AlexBroadbent commented 1 year ago

Before you submit an issue we recommend you first check if an existing issue does not already exist.

Please read this entire template before posting any issue. If you ignore these instructions and post an issue here that does not follow the instructions, your issue might be closed.

🐛 Bug Report

Using log.debug({ object }, "Debug message"); does not send into Datadog

To Reproduce

Steps to reproduce the behavior:

Paste your code here:

import pino from "pino";
import datadog from "pino-datadog";

const streams = [
  { stream: process.stdout },
  { 
    stream: datadog.createWriteStreamSync({
      apiKey: process.env.DD_API_KEY,
      ddtags: `env:${process.env.NODE_ENV}`,
      eu: true,
    }); 
  }
];

const logger = pino( { level: "debug" }, pino.multistream(streams) );

logger.debug({ foo: "bar" }, "debug message");

Expected behavior

A clear and concise description of what you expected to happen.

Paste the results here:

A message in Datadog with:

{"level":20,"time":1670932284621,"pid":214789,"hostname":"service.host","foo": "bar","msg":"debug message"}

Your Environment

gitSambhal commented 1 year ago

Try adding the level to stream object also

const streams = [
  { level: 'debug', stream: process.stdout },
  { 
    level: 'debug', 
    stream: datadog.createWriteStreamSync({
      apiKey: process.env.DD_API_KEY,
      ddtags: `env:${process.env.NODE_ENV}`,
      eu: true,
    }); 
  }
];