Last active
July 13, 2017 16:11
-
-
Save mrister/56d643a1d4ef4109b90f1782211ab377 to your computer and use it in GitHub Desktop.
Es6 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
const bunyan = require('bunyan'); | |
const Bunyan2Loggly = require('bunyan-loggly'); | |
const 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, ...args){ | |
log.info([name, ...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