<commit_before>'use strict'

const constants = require('./constants')
const levels = require('./levels')
const logs = require('./logs')
let isNode = require('detect-node')

let currentLevel = constants.DEFAULT_LEVEL

const logatim = module.exports = str => {
  if (str) logs.addChunk({ key: 'str', val: str })

  const speaker = message => logatim(message)

  // Leveling & options
  speaker.getLevel = () => levels.getLevel(currentLevel)
  speaker.setLevel = (level) => {
    currentLevel = levels.setLevel(level, isNode)
    speaker.raw = logs.raw.bind(null, isNode)
    logs.updateLogMethods(speaker, currentLevel, isNode, logatim)
  }
  speaker.setEnv = (env) => {
    isNode = (env === 'node')
    speaker.raw = logs.raw.bind(null, isNode)
    logs.updateLogMethods(speaker, currentLevel, isNode, logatim)
  }

  Object.keys(constants.STYLES).forEach(styleName => {
    Object.defineProperty(speaker, styleName, {
      get: () => {
        logs.addChunk({ key: 'style', val: styleName })
        return logatim()
      }
    })
  })

  // Get the unformatted message
  speaker.raw = logs.raw.bind(null, isNode)

  // Refresh reachable methods
  speaker.setLevel(levels.getPersistedLevel(isNode) || currentLevel)
  logs.updateLogMethods(speaker, currentLevel, isNode, logatim)

  return speaker
}
<commit_msg>perf: Override speaker.inspect<commit_after>'use strict'

const constants = require('./constants')
const levels = require('./levels')
const logs = require('./logs')
let isNode = require('detect-node')

let currentLevel = constants.DEFAULT_LEVEL

const logatim = module.exports = str => {
  if (str) logs.addChunk({ key: 'str', val: str })

  const speaker = message => logatim(message)
  speaker.inspect = () => undefined // don't pollute the REPL

  // Leveling & options
  speaker.getLevel = () => levels.getLevel(currentLevel)
  speaker.setLevel = (level) => {
    currentLevel = levels.setLevel(level, isNode)
    speaker.raw = logs.raw.bind(null, isNode)
    logs.updateLogMethods(speaker, currentLevel, isNode, logatim)
  }
  speaker.setEnv = (env) => {
    isNode = (env === 'node')
    speaker.raw = logs.raw.bind(null, isNode)
    logs.updateLogMethods(speaker, currentLevel, isNode, logatim)
  }

  Object.keys(constants.STYLES).forEach(styleName => {
    Object.defineProperty(speaker, styleName, {
      get: () => {
        logs.addChunk({ key: 'style', val: styleName })
        return logatim()
      }
    })
  })

  // Get the unformatted message
  speaker.raw = logs.raw.bind(null, isNode)

  // Refresh reachable methods
  speaker.setLevel(levels.getPersistedLevel(isNode) || currentLevel)
  logs.updateLogMethods(speaker, currentLevel, isNode, logatim)

  return speaker
}

{'fraction_non_alphanumeric': 0.14222386405615073, 'fraction_numerical': 0.0, 'mean_word_length': 3.759226713532513, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 18, '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': '2587687', 'n_tokens_mistral': 875, 'n_tokens_neox': 876, 'n_words': 186}