0

I'm trying to fix an issue with Candy.js (which uses Strophe.js) in which we use Candy.core.attach (after server side prebind).

There is an issue I can resolve. I'd really like to have access to the strophe.js logs (not just the packet logging that candy captures from strophe). I know strophe has low level logging, how can I get candy to make use of it?

Tony
  • 1,986
  • 2
  • 25
  • 36
  • Would it be possible to modify the source of either Strophe.js or Candy.js directly? After looking through Candy.Core, I'm not seeing any public functions/properties to access Strophe. – fpsColton Sep 16 '14 at 21:52
  • I that is the issue. Thanks. adding debug:true in the candy.init enables candy logging, but not the low level strophe logging – Tony Sep 17 '14 at 13:29

2 Answers2

0

In the init, set debug to true

Candy.init($('BoshPath').val(), {
    core: { debug: true, autojoin: [chatroom] },
        view: {
            resources: '/scripts/Candy/res/', crop: {
                message: { nickname: 18, body: 250 },
                roster: { nickname: 21 }
            }
        }
});

Also, in Candy, find the "self.init = function (service, options)" line (around line 130ish). You can customize if you so choose.

if (_options.debug) {
    self.log = function (str) {
        try { // prevent erroring
            if (typeof window.console !== undefined && typeof window.console.log !== undefined) {
                console.log(str);
             }
        } catch (e) { }
    };
    self.log('[Init] Debugging enabled');
}
Mark S
  • 869
  • 6
  • 11
0

I ended up modifying my local copy of candy/strophe to enable the low-level logging I was looking for as it doesn't appear as though Candy provides a means to enable strophe's low leveling logging.

Tony
  • 1,986
  • 2
  • 25
  • 36