<commit_before>import boot from './boot';
import logger from 'debug';
import React from 'react/addons';

const debug = logger('app:init');

// Executed when the browser has loaded everything.
window.onload = () => {
    debug('`onload` event fired.');
    debug('Initialize and start application.');

    // TODO: pass global functions to react components through context, not
    // window.
    const {t, router, application} = boot(window);

    // Handy localization shortcut.
    window.t = t;

    // Helper to allow link creation all around the application.
    window.router = router;

    debug('Mount React application');
    const node = document.querySelector('#mount-point');
    React.render(application, node);

    debug('Application started.');
};<commit_msg>Add helper function to help users enable logging<commit_after>import boot from './boot';
import logger from 'debug';
import React from 'react/addons';

const debug = logger('app:init');

// Executed when the browser has loaded everything.
window.onload = () => {
    debug('`onload` event fired.');
    debug('Initialize and start application.');

    // TODO: pass global functions to react components through context, not
    // window.
    const {t, router, application} = boot(window);

    // Handy localization shortcut.
    window.t = t;

    // Helper to allow link creation all around the application.
    window.router = router;

    debug('Mount React application');
    const node = document.querySelector('#mount-point');
    React.render(application, node);

    debug('Application started.');
};

// Helper that people can use to enable logging from the console.
window.debug = (pattern = 'app:*') => {
    console.info(`Reload the page to see logs that match pattern ${pattern}`); // eslint-disable-line
    localStorage.setItem('debug', pattern);
};
{'fraction_non_alphanumeric': 0.1287343834872352, 'fraction_numerical': 0.0, 'mean_word_length': 3.5707196029776673, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, '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': '1843951', 'n_tokens_mistral': 485, 'n_tokens_neox': 483, 'n_words': 178}