如何通过糖果启用strophe日志记录?

时间:2014-09-16 17:14:15

标签: xmpp openfire strophe candy

我正在尝试解决Candy.js(使用Strophe.js)的问题,其中我们使用Candy.core.attach(在服务器端预绑定之后)。

我可以解决一个问题。我真的很想访问strophe.js日志(不仅仅是糖果从strophe捕获的数据包记录)。我知道strophe有低水平的记录,我怎么能得到糖果才能使用呢?

2 个答案:

答案 0 :(得分:0)

在init中,将debug设置为true

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

另外,在Candy中,找到" self.init = function(service,options)"线(约130ish线)。如果您愿意,可以自定义。

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

答案 1 :(得分:0)

我最终修改了我的本地糖果/ strophe副本以启用我正在寻找的低级别日志记录,因为它似乎并不像Candy提供了一种方法来启用strophe的低水准日志记录。