Skip to content

Instantly share code, notes, and snippets.

@blindman2k
Created September 26, 2013 00:38
Show Gist options
  • Save blindman2k/6708281 to your computer and use it in GitHub Desktop.
Save blindman2k/6708281 to your computer and use it in GitHub Desktop.
Posting log entries to Loggly
const LOGGLY_URL = "https://logs-01.loggly.com/inputs/TOKEN/tag/imp/";
function log(message, callback = null) {
if (typeof message != "object") {
message = {message = message};
}
http.post(LOGGLY_URL, {}, http.jsonencode(message)).sendasync(function (res) {
if (res.statuscode != 200) server.log("Error posting to Logly: " + res.statuscode);
if (callback) callback(res);
})
}
log("Hello, world!");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment