How to use the @converse/headless/log.setLogLevel function in @converse/headless

To help you get started, we’ve selected a few @converse/headless examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github conversejs / converse.js / src / headless / converse-core.js View on Github external
// closed/destroyed. It's the only viable event on mobile Safari.
        // https://www.webkit.org/blog/516/webkit-page-cache-ii-the-unload-event/
        _converse.unloadevent = 'pagehide';
    } else if ('onbeforeunload' in window) {
        _converse.unloadevent = 'beforeunload';
    } else if ('onunload' in window) {
        _converse.unloadevent = 'unload';
    }

    _.assignIn(this, this.default_settings);
    // Allow only whitelisted configuration attributes to be overwritten
    _.assignIn(this, _.pick(settings, Object.keys(this.default_settings)));
    this.settings = {};
    _.assignIn(this.settings, _.pick(settings, Object.keys(this.default_settings)));

    log.setLogLevel(_converse.loglevel);
    _converse.log = log.log;

    if (this.authentication === _converse.ANONYMOUS) {
        if (this.auto_login && !this.jid) {
            throw new Error("Config Error: you need to provide the server's " +
                  "domain via the 'jid' option when using anonymous " +
                  "authentication with auto_login.");
        }
    }

    _converse.router.route(
        /^converse\?loglevel=(debug|info|warn|error|fatal)$/, 'loglevel',
        l => log.setLogLevel(l)
    );

    /* Localisation */