From 8f4cddc04c67e20f86a73f9663d92bba0e27efd5 Mon Sep 17 00:00:00 2001 From: Samir Musali Date: Tue, 19 Mar 2019 18:30:17 +0000 Subject: [PATCH] Adding `LogDNA Winston` Transport (#1610) * Adding LogDNA Winston Transport * No Need for Semicolons * Update LogDNA transports text Tightened example code to more relevant bits and removed non-technical text --- docs/transports.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/docs/transports.md b/docs/transports.md index ff70f4f10..562737950 100644 --- a/docs/transports.md +++ b/docs/transports.md @@ -41,6 +41,7 @@ there are additional transports written by * [FastFileRotate](#fastfilerotate-transport) * [Google Stackdriver Logging](#google-stackdriver-transport) * [Graylog2](#graylog2-transport) + * [LogDNA](#logdna-transport) * [Logsene](#logsene-transport) (including Log-Alerts and Anomaly Detection) * [Logz.io](#logzio-transport) * [Mail](#mail-transport) @@ -462,6 +463,35 @@ const logger = winston.createLogger({ }) ``` +### LogDNA Transport + +[LogDNA Winston][37] is a transport for being able to forward the logs to [LogDNA](https://logdna.com/): + +``` js +const logdnaWinston = require('logdna-winston'); +const winston = require('winston'); +const logger = winston.createLogger({}); +const options = { + key: apikey, // the only field required + hostname: myHostname, + ip: ipAddress, + mac: macAddress, + app: appName, + env: envName, + index_meta: true // Defaults to false, when true ensures meta object will be searchable +}; + +// Only add this line in order to track exceptions +options.handleExceptions = true; + +logger.add(new logdnaWinston(options)); + +let meta = { + data:'Some information' +}; +logger.log('info', 'Log from LogDNA Winston', meta); +``` + ### Logzio Transport You can download the logzio transport here : [https://github.com/logzio/winston-logzio](https://github.com/logzio/winston-logzio) @@ -767,3 +797,4 @@ That's why we say it's a logger for just about everything [34]: https://github.com/hakanostrom/winston-cloudant [35]: https://github.com/SerayaEryn/fast-file-rotate [36]: https://github.com/inspiredjw/winston-dynamodb +[37]: https://github.com/logdna/logdna-winston