Los Angeles, CA

Anyone a big fan of npm tracer?

Anyone a big fan of npm tracer?

I was googling for hours how can i use bunyan with tracer but nobody (first 2 pages of google) has written anything about it.

Here is an example of my bad code that does the job. Let me know if you want me to further dumb it down

var bunyan = require('bunyan');
var Bunyan2Loggly = require('bunyan-loggly').Bunyan2Loggly;


/**
* bunyan loggly
*/

var blog = bunyan.createLogger({
name: 'PureText',
streams: [
{
type: 'raw',
stream: new Bunyan2Loggly(config.LOGGLY_SETTINGS)
}
//,{
// stream: process.stdout,
// level: "debug"
//}

]
});


var log_conf = {
transport: function (data) {

try {
var objToLog = {
line: data.line,
file: data.file,
method: data.method,
message: data.message
}
blog.info(objToLog);
//console.log(objToLog);
console.log(data.output);
} catch (e) {
console.log(e)
}

}
}

var logger = require('tracer').console(log_conf);

Facebook Comments