logdna / nodejs

Node.js library for logging to LogDNA
MIT License
74 stars 66 forks source link

Singleton example not working #14

Closed rsweetland closed 7 years ago

rsweetland commented 7 years ago

My apologies if this is user error...

This doesn't work:

var options = {
    hostname: 'localhost',
    app: 'app-name'
};
var logger = Logger. setupDefaultLogger('KEY', options);  //singleton
logger.log('test');  //never arrives on logdna

This does:

var options = {
    hostname: 'localhost',
    app: 'app-name'
};
var logger = Logger.createLogger('KEY', options);
logger.log('test');
respectus commented 7 years ago

Hi @rsweetland, I've taken a look at the example code you posted and I notice that there is a space in between Logger. and the method setupDefaultLogger. If you use Logger.setupDefaultLogger without a space, and you set your Ingestion Key to the one in your Account Profile you should be able to see log statements. I have tested the code, with the space removed, and it works fine for me. Let me know if you run into any further issues or have any other questions, thanks!

rsweetland commented 7 years ago

@respectus really appreciate the fast response even though this was totally my fault! Just upgraded my LogDNA account (my second paid account with you guys).

respectus commented 7 years ago

No worries, glad I could be of help! Appreciate the feedback, it's the best way for us to improve the product :)