Node.js Winston library for logging to LogDNA
Install
$ npm install --save logdna-winston
API
Please see the logdna npm module for the API.
Winston Transport
This module also provides a transport object, which can be added to winston using:
const logdnaWinston = require('logdna-winston');
const winston = require('winston');
const logger = winston.createLogger({});
const options = {
key: apikey,
hostname: myHostname,
ip: ipAddress,
mac: macAddress,
app: appName,
env: envName,
level: level,
index_meta: true
};
options.handleExceptions = true;
logger.add(new logdnaWinston(options));
logger.log({
level: 'info'
, message: 'Log from LogDNA-winston'
, index_meta: true
, data:'Some information'
, error: new Error("It's a trap.")
});
logger.info('Info: Log from LogDNA-winston');
License
MIT © LogDNA
Happy Logging!