<commit_before># Wrapper for pushing events to Rollbar
if _rollbar? && KD.config.logToExternal then do ->
  KD.logToExternal = (args) ->
    _rollbar.push args  unless KD.isGuest()

  # set user info in rollbar for people tracking
  KD.getSingleton('mainController').on "AccountChanged", (account) ->
    user = KD.whoami?().profile or KD.whoami()
    _rollbarParams.person =
      id       : user.hash or user.nickname
      name     : KD.utils.getFullnameFromAccount()
      username : user.nickname
else
  KD.utils.stopRollbar()
  KD.logToExternal = (args) -><commit_msg>rollbar: move def. from utils to KD itself<commit_after># Wrapper for pushing events to Rollbar
if _rollbar? && KD.config.logToExternal then do ->
  KD.logToExternal = (args) ->
    _rollbar.push args  unless KD.isGuest()

  # log ping times so we know if failure was due to user's slow
  # internet or our internals timing out
  KD.logToExternalWithTime = (name, timeout)->
    KD.troubleshoot (times)->
      KD.logToExternal msg:"#{name} timed out in #{timeout}", pings:times

  # set user info in rollbar for people tracking
  KD.getSingleton('mainController').on "AccountChanged", (account) ->
    user = KD.whoami?().profile or KD.whoami()
    _rollbarParams.person =
      id       : user.hash or user.nickname
      name     : KD.utils.getFullnameFromAccount()
      username : user.nickname
else
  KD.utils.stopRollbar()
  KD.logToExternal         =->
  KD.logToExternalWithTime =->
{'fraction_non_alphanumeric': 0.11126279863481228, 'fraction_numerical': 0.0, 'mean_word_length': 3.2740524781341107, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 14, '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': '1329603', 'n_tokens_mistral': 485, 'n_tokens_neox': 455, 'n_words': 130}