Last active
July 13, 2017 16:11
-
-
Save mrister/d6a5c0abd763f685810d1df6469e9890 to your computer and use it in GitHub Desktop.
Transpiled example of logging to Loggly using Bunyan
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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