mperdeck/jsnlog.js

Newbie needs help setting server URL

Opened this issue · 4 comments

Thank you for the efforts. I am excited to use this in my project.

var logger = JL();
logger.setOptions({
  "defaultAjaxUrl": "/assets/php/jsnlogger.php"
});
logger.fatal('test message');

I tried this, but it is still trying to send log error messages to /jsnlog.logger. What am I doing wrong?

You set the defaultAjaxUrl option on a logger. However, loggers do not support that option. It needs to be set on the library itself.
http://jsnlog.com/Documentation/JSNLogJs/JL/SetOptions

It would look like this:
JL.setOptions({
"defaultAjaxUrl": "/assets/php/jsnlogger.php"
});

Oh, there it is, in the Examples section. I must have been in a hurry. Thanks for getting back to me! I got the PHP part installed too now. It's really a very useful library.

where should i set this option in angular4?
JL.setOptions({
"defaultAjaxUrl": "My Path"
});
Thanks

That's an Angular 4 question, not a JSNLog question. You will want to do this when your application loads, after the jsnlog.js library has loaded.