Tony
Tony

Reputation: 2066

How to enable strophe logging via candy?

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?

Upvotes: 0

Views: 463

Answers (2)

Tony
Tony

Reputation: 2066

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.

Upvotes: 0

Mark S
Mark S

Reputation: 869

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

Upvotes: 0

Related Questions