<commit_before>(function() {

    zeit.cms.declare_namespace('zeit.cms.logging');

    zeit.cms.logging.CONSOLE_LEVEL = 'DEBUG';
    zeit.cms.logging.XHR_LEVEL = 'ERROR';

    /* Disable default logger */
    MochiKit.Logging.logger.useNativeConsole = false;

    /* XHR logger logging errors to server error log */
    var xhr_listener = function(msg) {
        var url = window.application_url + '/@@log.json';
        var data = MochiKit.Base.serializeJSON(
          {'level': msg.level,
           'timestamp': msg.timestamp.toJSON(),
           'url': window.location.href,
           'message': msg.info});
        var d = MochiKit.Async.doXHR(url, {
            method: 'POST',
            sendContent: data});
        d.addErrback(function(e) {
            alert(
              'Logging failed because of ' + e +
              '\n\nOriginal error which was NOT logged:\n' +
                msg.info);
        });
    };

    var FIREBUG_LOG_LEVELS = {
        'DEBUG': 'debug',
        'INFO': 'info',
        'ERROR': 'error',
        'FATAL': 'error',
        'WARNING': 'warn'};

    /* Console logger for debug purpose */
    var console_listener = function(msg) {
        console[FIREBUG_LOG_LEVELS[msg.level]](
            msg.timestamp.toJSON() + ": "  + msg.info);
    };

    MochiKit.Logging.logger.addListener(
        'xhr-listener', zeit.cms.logging.XHR_LEVEL, xhr_listener);
    MochiKit.Logging.logger.addListener(
        'console-listener', zeit.cms.logging.CONSOLE_LEVEL, console_listener);

    window.onerror = function(err, url, line) {
      logError(url + " line " + line + ": " + err);
    };

}(jQuery));<commit_msg>Re #12417: Don't require application_url, since it's not there e.g. in fixture-based Selenium tests<commit_after>(function() {

    zeit.cms.declare_namespace('zeit.cms.logging');

    zeit.cms.logging.CONSOLE_LEVEL = 'DEBUG';
    zeit.cms.logging.XHR_LEVEL = 'ERROR';

    /* Disable default logger */
    MochiKit.Logging.logger.useNativeConsole = false;

    /* XHR logger logging errors to server error log */
    var xhr_listener = function(msg) {
        var url = window.application_url + '/@@log.json';
        var data = MochiKit.Base.serializeJSON(
          {'level': msg.level,
           'timestamp': msg.timestamp.toJSON(),
           'url': window.location.href,
           'message': msg.info});
        var d = MochiKit.Async.doXHR(url, {
            method: 'POST',
            sendContent: data});
        d.addErrback(function(e) {
            alert(
              'Logging failed because of ' + e +
              '\n\nOriginal error which was NOT logged:\n' +
                msg.info);
        });
    };

    var FIREBUG_LOG_LEVELS = {
        'DEBUG': 'debug',
        'INFO': 'info',
        'ERROR': 'error',
        'FATAL': 'error',
        'WARNING': 'warn'};

    /* Console logger for debug purpose */
    var console_listener = function(msg) {
        console[FIREBUG_LOG_LEVELS[msg.level]](
            msg.timestamp.toJSON() + ": "  + msg.info);
    };

    if (window.application_url) {
        MochiKit.Logging.logger.addListener(
            'xhr-listener', zeit.cms.logging.XHR_LEVEL, xhr_listener);
    } else {
        MochiKit.Logging.logger.logWarning(
            'No application_url defined, XHR logging disabled');
    }
    MochiKit.Logging.logger.addListener(
        'console-listener', zeit.cms.logging.CONSOLE_LEVEL, console_listener);

    window.onerror = function(err, url, line) {
      logError(url + " line " + line + ": " + err);
    };

}(jQuery));
{'fraction_non_alphanumeric': 0.14285714285714285, 'fraction_numerical': 0.00140607424071991, 'mean_word_length': 2.2131887985546523, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5982544', 'n_tokens_mistral': 1144, 'n_tokens_neox': 1101, 'n_words': 218}