<commit_before>import Raven from 'raven-js';
import { first } from 'lodash';
const isProd = (process.env.NODE_ENV === 'production');

const isMathJaxUrl = /mathjax/;

const isMathjax = (crumb) => ('xhr' === crumb.category && isMathJaxUrl.test(crumb.data.url));

const RavenErrorLogging = {

  boot() {
    if (!isProd) { return; }
    Raven.config('https://10044345c10446119e980e2ba2f5fe14@sentry.cnx.org/10', {
      tags: {
        environment: first(window.location.host.split('.')),
      },
      breadcrumbCallback(crumb) {
        if (isMathjax(crumb)) { return false; }
        return crumb;
      },
    }).install();
  },

  setUser(user) {
    Raven.setUserContext({
      id: user.account_uuid,
    });
  },

  captureException(error, xtra) {
    Raven.captureException(error, xtra)
  },

};


export default RavenErrorLogging;
<commit_msg>warn when an error is logged if not production<commit_after>import Raven from 'raven-js';
import { first } from 'lodash';
const isProd = (process.env.NODE_ENV === 'production');

const isMathJaxUrl = /mathjax/;

const isMathjax = (crumb) => ('xhr' === crumb.category && isMathJaxUrl.test(crumb.data.url));

const RavenErrorLogging = {

  boot() {
    if (!isProd) { return; }
    Raven.config('https://10044345c10446119e980e2ba2f5fe14@sentry.cnx.org/10', {
      tags: {
        environment: first(window.location.host.split('.')),
      },
      breadcrumbCallback(crumb) {
        if (isMathjax(crumb)) { return false; }
        return crumb;
      },
    }).install();
  },

  setUser(user) {
    Raven.setUserContext({
      id: user.account_uuid,
    });
  },

  captureException(error, xtra) {
    if (!isProd) {
      console.warn(error); // eslint-disable-line no-console
    }
    Raven.captureException(error, xtra);
  },

};


export default RavenErrorLogging;

{'fraction_non_alphanumeric': 0.15734649122807018, 'fraction_numerical': 0.02850877192982456, 'mean_word_length': 3.1762013729977117, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '1183870', 'n_tokens_mistral': 685, 'n_tokens_neox': 646, 'n_words': 113}