First working version
tried examples/loggly-appender.js [OK]
This commit is contained in:
parent
5286c50375
commit
eb51aa99be
@ -1,10 +1,8 @@
|
||||
//Note that loggly appender needs node-loggly to work.
|
||||
//If you haven't got node-loggly installed, you'll get cryptic
|
||||
//"cannot find module" errors when using the loggly appender
|
||||
var log4js = require('../lib/log4js')
|
||||
, log
|
||||
, logmailer
|
||||
, i = 0;
|
||||
var log4js = require('../lib/log4js');
|
||||
|
||||
log4js.configure({
|
||||
"appenders": [
|
||||
{
|
||||
@ -12,15 +10,15 @@ log4js.configure({
|
||||
category: "test"
|
||||
},
|
||||
{
|
||||
"type": "loggly",
|
||||
"token": "12345678901234567890",
|
||||
"type" : "loggly",
|
||||
"token" : "12345678901234567890",
|
||||
"subdomain": "your-subdomain",
|
||||
"tags": ["test"],
|
||||
"category": "test"
|
||||
"tags" : ["test"],
|
||||
"category" : "loggly"
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
var logger = log4js.getLogger("test");
|
||||
var logger = log4js.getLogger("loggly");
|
||||
logger.info("Test log message");
|
||||
logger.debug("Test log message");
|
||||
//logger.debug("Test log message");
|
@ -1,6 +1,6 @@
|
||||
"use strict";
|
||||
var layouts = require("../layouts")
|
||||
, mailer = require("loggly")
|
||||
, loggly = require("loggly")
|
||||
, os = require('os');
|
||||
|
||||
|
||||
@ -22,7 +22,14 @@ function logglyAppender(config, layout) {
|
||||
|
||||
|
||||
return function(loggingEvent) {
|
||||
client.log(layout(loggingEvent));
|
||||
console.log('attempts', loggingEvent, layout(loggingEvent), config.tags);
|
||||
client.log(layout(loggingEvent), config.tags, function(err, result){
|
||||
if (err) {
|
||||
console.log('Loggly: '+ err.message);
|
||||
} else {
|
||||
console.log('Loggly: '+ JSON.stringify(result));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user