Skip to content

Instantly share code, notes, and snippets.

@mrister
Last active July 13, 2017 16:11
Show Gist options
  • Save mrister/d6a5c0abd763f685810d1df6469e9890 to your computer and use it in GitHub Desktop.
Save mrister/d6a5c0abd763f685810d1df6469e9890 to your computer and use it in GitHub Desktop.
Transpiled example of logging to Loggly using Bunyan
'use strict';
var bunyan = require('bunyan');
var Bunyan2Loggly = require('bunyan-loggly');
var log = bunyan.createLogger({
name: 'logglylog',
streams: [{
type: 'raw',
stream: new Bunyan2Loggly({
token: '<your token>',
subdomain: '<your subdomain>',
json: true
})
}]
});
// utility function for sample logging
function logItems(name) {
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
log.info([name].concat(args));
}
// log the object
logItems('test items', '1', '2', '3', 'done');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment