mperdeck / jsnlog.js

Tiny JavaScript logging library, simple and well documented. Lots of options to filter logging data.
js.jsnlog.com
Other
130 stars 44 forks source link

Newbie needs help setting server URL #44

Closed ghost closed 7 years ago

ghost commented 7 years ago

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?

mperdeck commented 7 years ago

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" });

ghost commented 7 years ago

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.

andrewsafwat commented 6 years ago

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

mperdeck commented 6 years ago

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.