@loglayer/transport-datadog
v2.0.4
Published
DataDog transport for loglayer.
Downloads
719
Maintainers
Readme
Datadog Transport for LogLayer
The DataDog transport for LogLayer.
Ships logs to DataDog using the datadog-transport-common library.
Important Notes
- Only works server-side (not in browsers)
- For browser-side logging, use the
@loglayer/transport-datadog-browser-logs
package
- For browser-side logging, use the
- You will not get any console output since this sends directly to DataDog. Use the
onDebug
option to log out messages.
Installation
npm install loglayer @loglayer/transport-datadog serialize-error
Usage
import { LogLayer } from 'loglayer'
import { DataDogTransport } from "@loglayer/transport-datadog"
import { serializeError } from "serialize-error";
const log = new LogLayer({
errorSerializer: serializeError,
transport: new DataDogTransport({
options: {
ddClientConf: {
authMethods: {
apiKeyAuth: "YOUR_API_KEY",
},
},
ddServerConf: {
// Note: This must match the site you use for your DataDog login - See below for more info
site: "datadoghq.eu"
},
onDebug: (msg) => {
console.log(msg);
},
onError: (err, logs) => {
console.error(err, logs);
},
},
})
})
See the documentation for more information.